Skip to content

Commit

Permalink
chore: remove extraneous logging
Browse files Browse the repository at this point in the history
  • Loading branch information
pgautier404 committed Oct 9, 2023
1 parent 256fddf commit 174f448
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 17 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ A Momento API Token is required. You can generate one using the [Momento Console

## Installation

Add the module with `composer require 'momentohq/drupal-cache:v0.2.0'`. You may need to edit your `composer.json` to set `minimum-stability` to `dev`.
Add the module with `composer require 'momentohq/drupal-cache:v0.2.1'`. You may need to edit your `composer.json` to set `minimum-stability` to `dev`.

Enable the module in your Drupal administrator interface.

Expand Down
19 changes: 3 additions & 16 deletions src/MomentoCacheBackend.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,19 +67,13 @@ private function isValid($item) {
// see if there's an invalidation timestamp in the cache
$getResponse = $this->client->get($this->tagsCacheName, $tag);
if ($getResponse->asHit()) {
$this->getLogger('momento_cache_tag_validation')->debug(
"FOUND INVALIDATION RECORD FOR $tag in bin $this->bin"
);
$invalidatedTags[$tag] = (float)$getResponse->asHit()->valueString();
$this->getLogger('momento_cache_tag_validation')->debug(
"INVALIDATED: " . implode(', ', array_keys($invalidatedTags))
);
if ($invalidatedTags[$tag] > $item->created) {
$isValid = FALSE;
break;
}
} elseif ($getResponse->asError()) {
$this->getLogger('momento_cache_tag_validation')->error(
$this->getLogger('momento_cache')->error(
"Error fetching invalidated tag record for $tag: " . $getResponse->asError()->message()
);
}
Expand Down Expand Up @@ -155,7 +149,7 @@ public function set($cid, $data, $expire = CacheBackendInterface::CACHE_PERMANEN
if ($setResponse->asError()) {
$this->getLogger('momento_cache')->error("SET response error for bin $this->bin: " . $setResponse->asError()->message());
} else {
$this->getLogger('momento_cache_tags')->debug(
$this->getLogger('momento_cache')->debug(
"SET $this->bin:$cid with tags: " . implode(', ', $item->tags)
);
}
Expand Down Expand Up @@ -249,19 +243,12 @@ public function invalidateTags(array $tags)
{
$tags = array_unique($tags);
$invalidateTime = round(microtime(TRUE), 3);
$this->getLogger('momento_cache_tag_validation')->debug(
"INVALIDATE_TAGS in bin $this->bin with tags: " . implode(', ', $tags)
);
foreach ($tags as $tag) {
$setResponse = $this->client->set($this->tagsCacheName, $tag, $invalidateTime, $this->MAX_TTL);
if ($setResponse->asError()) {
$this->getLogger('momento_cache_tag_validation')->error(
$this->getLogger('momento_cache')->error(
"INVALIDATE_TAGS response error $tag: " . $setResponse->asError()->message()
);
} else {
$this->getLogger('momento_cache_tag_validation')->debug(
"INVALIDATE_TAGS invalidated $tag in $this->bin at $invalidateTime"
);
}
}
}
Expand Down

0 comments on commit 174f448

Please sign in to comment.