Skip to content

Commit 4617340

Browse files
Merge pull request #71 from utopia-php/feat-new-methods-for-purging-cache
Added new methods for purging cache
2 parents 5dd58c1 + 84d1ada commit 4617340

1 file changed

Lines changed: 14 additions & 2 deletions

File tree

src/Database/Database.php

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -808,14 +808,26 @@ public function deleteDocument(string $collection, string $id): bool
808808
}
809809

810810
/**
811-
* Cleans the Document from Cache
811+
* Cleans the all the collection's documents from the cache
812+
*
813+
* @param string $collection
814+
*
815+
* @return bool
816+
*/
817+
public function deleteCachedCollection(string $collection): bool
818+
{
819+
return $this->cache->purge('cache-'.$this->getNamespace().':'.$collection.':*');
820+
}
821+
822+
/**
823+
* Cleans a specific document from cache
812824
*
813825
* @param string $collection
814826
* @param string $id
815827
*
816828
* @return bool
817829
*/
818-
public function purgeDocument(string $collection, string $id): bool
830+
public function deleteCachedDocument(string $collection, string $id): bool
819831
{
820832
return $this->cache->purge('cache-'.$this->getNamespace().':'.$collection.':'.$id);
821833
}

0 commit comments

Comments
 (0)