Skip to content

Commit

Permalink
refactor:cache flow
Browse files Browse the repository at this point in the history
  • Loading branch information
shimonewman committed May 31, 2024
1 parent ac73ba5 commit 2640e41
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/Database/Database.php
Original file line number Diff line number Diff line change
Expand Up @@ -2786,9 +2786,8 @@ public function getDocument(string $collection, string $id, array $queries = [])
if (!$hasTwoWayRelationship && empty($relationships)) {
$this->cache->save($documentCacheHash.'---'.$documentCacheKey, $document->getArrayCopy());
//add document reference to the collection hash
var_dump('Saving '.$collectionCacheHash.'---'.$documentCacheHash);
$bla = $this->cache->save($collectionCacheHash.'---'.$documentCacheHash, 'bla');
var_dump($bla);
$this->cache->save($collectionCacheHash.'---'.$documentCacheHash, 'empty');

}

// Remove internal attributes if not queried for select query
Expand Down Expand Up @@ -4749,6 +4748,8 @@ public function purgeCachedCollection(string $collection): bool
*/
public function purgeCachedDocument(string $collection, string $id): bool
{
$collectionCacheHash = $this->cacheName . '-cache-' . $this->getNamespace() . ':' . $this->adapter->getTenant() . ':' . $collection . ':collection';
// Todo we should implement HDEL on the collection
return $this->cache->purge($this->cacheName . '-cache-' . $this->getNamespace() . ':' . $this->adapter->getTenant() . ':' . $collection . ':' . $id);
}

Expand Down

0 comments on commit 2640e41

Please sign in to comment.