Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache[K comparable, V any] struct { // contains filtered or unexported fields }
Cache structure to be used for handling the cache data
func NewCache ¶
func NewCache[K comparable, V any](setSize int, replacementAlgorithm ...ReplacementAlgo) (*Cache[K, V], error)
NewCache returns a new instance of Cache. It saves the provided setSize in the returned instance
func (*Cache[K, V]) Delete ¶
func (c *Cache[K, V]) Delete(key K)
Delete removes the item associated to the provided key if it's found.
func (*Cache[K, V]) Get ¶
Get returns the item if it's present in cache and a true flag. Otherwise it returns false and an empty value
type ReplacementAlgo ¶
type ReplacementAlgo string
const ( LRU_ALGO ReplacementAlgo = "LRU" MRU_ALGO ReplacementAlgo = "MRU" )
Click to show internal directories.
Click to hide internal directories.