Documentation
¶
Index ¶
- type BasicCache
- func (c *BasicCache[K, V]) Add(key K, value V, expiration time.Duration) bool
- func (c *BasicCache[K, V]) Delete(key K) bool
- func (c *BasicCache[K, V]) Exists(key K) bool
- func (c *BasicCache[K, V]) Get(key K) (V, bool)
- func (c *BasicCache[K, V]) Keys() []K
- func (c *BasicCache[K, V]) Update(key K, newValue V, expiration time.Duration) bool
- type Cache
- type EmptyServerOption
- type Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BasicCache ¶
func (*BasicCache[K, V]) Add ¶
func (c *BasicCache[K, V]) Add(key K, value V, expiration time.Duration) bool
Add add new time to cache
- expiration: 0 for disable expire cache
func (*BasicCache[K, V]) Delete ¶
func (c *BasicCache[K, V]) Delete(key K) bool
func (*BasicCache[K, V]) Exists ¶
func (c *BasicCache[K, V]) Exists(key K) bool
func (*BasicCache[K, V]) Get ¶
func (c *BasicCache[K, V]) Get(key K) (V, bool)
func (*BasicCache[K, V]) Keys ¶
func (c *BasicCache[K, V]) Keys() []K
type Cache ¶
type Cache[K any, V any] interface { // Add store your item to cache Add(key K, value V, expiration time.Duration) bool // Get load your item from cache Get(key K) (V, bool) // Update updates the Value of an existing entry in the cache. Update(key K, newValue V, expiration time.Duration) bool // Exists check your key exists in cache Exists(key K) bool // Keys return list of keys in cache Keys() []K // Delete delete specific item from cache base on key Delete(key K) bool }
type EmptyServerOption ¶
type EmptyServerOption struct{}
Click to show internal directories.
Click to hide internal directories.