[#547] Cache empty lists without error

Signed-off-by: Denis Kirillov <denis@nspcc.ru>
This commit is contained in:
Denis Kirillov 2022-06-24 11:27:32 +03:00 committed by Alex Vanin
parent 5984f2c2bc
commit 127b91a97f

View file

@ -96,19 +96,11 @@ func (l *ObjectsListCache) GetVersions(key ObjectsListKey) []*data.NodeVersion {
// Put puts a list of objects to cache.
func (l *ObjectsListCache) Put(key ObjectsListKey, oids []oid.ID) error {
if len(oids) == 0 {
return fmt.Errorf("list is empty, cid: %s, prefix: %s", key.cid, key.prefix)
}
return l.cache.Set(key, oids)
}
// PutVersions puts a list of object versions to cache.
func (l *ObjectsListCache) PutVersions(key ObjectsListKey, versions []*data.NodeVersion) error {
if len(versions) == 0 {
return fmt.Errorf("list versions is empty, cid: %s, prefix: %s", key.cid, key.prefix)
}
return l.cache.Set(key, versions)
}