feat: KeyStoreStringToBinary

This commit is contained in:
Artёm Mishin committed 2025-04-25 12:29:46 +03:00
1 parent 1d08501b51
commit 72a6625c14
5 files changed
+94 -1

No files matched your search

+13
View File
@@ -3,6 +3,11 @@ package universe_key_value
import (
"context"
"time"
"universe.mrlokop.dev/core/errors"
)
var (
ErrNoSuchKey = errors.Type("ErrNoSuchKey", "no such key")
)
type Capability uint8
@@ -22,8 +27,16 @@ type KeyValueStore[T any] interface {
HasCapability(capability Capability) bool
Get(ctx context.Context, key string) (T, error)
Has(ctx context.Context, key string) (bool, error)
Set(ctx context.Context, key string, value T) error
SetWithExpiration(ctx context.Context, key string, value T, expiresAt time.Time) error
SetIfNotExist(ctx context.Context, key string, value T) (bool, error)
SetIfNotExistWithExpiration(ctx context.Context, key string, value T, expiration time.Time) (bool, error)
ExpireAt(ctx context.Context, key string, expiration time.Time) error
Remove(ctx context.Context, key string) error
}