Documentation ¶ Index ¶ type Cache func NewCache(ttl time.Duration, maxCost int64) (*Cache, error) func (r *Cache) Get(key string) (any, bool) func (r *Cache) Set(key string, val any) type CacheInstance type CacheMethod Constants ¶ This section is empty. Variables ¶ This section is empty. Functions ¶ This section is empty. Types ¶ type Cache ¶ type Cache struct { // contains filtered or unexported fields } func NewCache ¶ func NewCache(ttl time.Duration, maxCost int64) (*Cache, error) func (*Cache) Get ¶ func (r *Cache) Get(key string) (any, bool) func (*Cache) Set ¶ func (r *Cache) Set(key string, val any) type CacheInstance ¶ type CacheInstance struct { TTL time.Duration `json:"TTL" mapstructure:"TTL"` // minisecond } type CacheMethod ¶ type CacheMethod interface { // Get returns the value for the given key. Get(key string) (any, bool) // Set sets the value for the given key. Set(key string, val any) } Source Files ¶ View all Source files RistrettoCache.gocache.go Click to show internal directories. Click to hide internal directories.