Documentation
¶
Overview ¶
Package mem implements a memory cache
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache[T any] struct { // contains filtered or unexported fields }
Cache implement a memory cache
func New ¶
New create instance memory cache
Parameters:
- defaultExpr is a time to live of items
- cleanInterval is cleanup cycle for expired items
func NewDefault ¶
NewDefault create new memory cache with, default expr is 1 minute and cleanup cycle is 1 minute
func (*Cache[T]) Get ¶
Get used to get value of key
Returns:
- result T is result data of Get function
- found bool is a second value of Get, true when value is found, false when value is not found
Click to show internal directories.
Click to hide internal directories.