Documentation
¶
Index ¶
Constants ¶
View Source
const (
StorageTypeMemory = StorageType("memory")
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶ added in v0.0.27
type Config struct {
StorageType StorageType
Dir string
}
type Interface ¶
type Interface[T any] interface { // Remember value by key. If key is exists and ttl is not expired then return value without call callback. // If key is not exists or ttl is expired then call callback and remember value by key. // Error is returned from callback if failed. Remember(key string, ttlS uint64, callback func() (T, error)) (T, error) // Clear all cache. Clear() // Forget cache value by key. Forget(key string) (T, error) // Determine your own logic with function to forget cache by key ForgetFn(func(key string) (T, error)) (T, error) // Get length of cache. Length() uint64 // Get cache value by key Get(key string) (T, error) // Get keys that stored on caches Keys() []string }
func InitMemory ¶ added in v0.0.27
type StorageType ¶ added in v0.0.27
type StorageType string
Click to show internal directories.
Click to hide internal directories.