use nats-js cache

Signed-off-by: jkoberg <jkoberg@owncloud.com>
This commit is contained in:
jkoberg
2023-11-23 12:33:42 +01:00
parent b4d1feea5f
commit 003310a2b0
7 changed files with 21 additions and 11 deletions
@@ -275,9 +275,7 @@ func (MessagePackBackend) IsMetaFile(path string) bool {
// Purge purges the data of a given path
func (b MessagePackBackend) Purge(path string) error {
if err := b.metaCache.RemoveMetadata(b.cacheKey(path)); err != nil {
return err
}
_ = b.metaCache.RemoveMetadata(b.cacheKey(path))
return os.Remove(b.MetadataPath(path))
}
@@ -291,10 +289,7 @@ func (b MessagePackBackend) Rename(oldPath, newPath string) error {
return err
}
}
err = b.metaCache.RemoveMetadata(b.cacheKey(oldPath))
if err != nil {
return err
}
_ = b.metaCache.RemoveMetadata(b.cacheKey(oldPath))
return os.Rename(b.MetadataPath(oldPath), b.MetadataPath(newPath))
}