Documentation
¶
Index ¶
- type Map
- func (t *Map[K, S]) Close() error
- func (t *Map[K, S]) Count() int
- func (t *Map[K, S]) Del(ctx context.Context, key K) error
- func (t *Map[K, S]) DelAll(ctx context.Context) error
- func (t *Map[K, S]) Exists(ctx context.Context, key K) (bool, error)
- func (t *Map[K, S]) Get(ctx context.Context, key K) (S, bool, error)
- func (t *Map[K, S]) MultiDel(ctx context.Context, keys []K) error
- func (t *Map[K, S]) MultiGet(ctx context.Context, keys []K) (map[K]S, error)
- func (t *Map[K, S]) MultiSet(ctx context.Context, valMap map[K]S) error
- func (t *Map[K, S]) MultiSetWithTTL(ctx context.Context, valMap map[K]S, expiration time.Duration) error
- func (t *Map[K, S]) Set(ctx context.Context, key K, val S) error
- func (t *Map[K, S]) SetWithTTL(ctx context.Context, key K, val S, expiration time.Duration) error
- func (t *Map[K, S]) Trim()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Map ¶
type Map[K comparable, S any] struct { // contains filtered or unexported fields }
Map is a simple in-memory cache implementation using Go's built-in map with read-write mutex protection. It supports TTL-based expiration and is suitable for lightweight caching needs without external dependencies.
func NewMapCache ¶
NewMapCache creates a new map-based cache for string keys and typed values. This is a lightweight alternative to more complex caching solutions.
func (*Map[K, S]) MultiSetWithTTL ¶
func (*Map[K, S]) SetWithTTL ¶
Click to show internal directories.
Click to hide internal directories.