A simple library in Go that does a basic implementation of the few most popular caching algorithms.
The caching eviction policies implemented are the following:
- FIFO (First in first out)
- LIFO (Last in first out)
- LRU (Least Recently Used)
You can make your own policy by embedding the EvictionPolicy
base struct in your policy.
Please note that in each example, the respective cache variable has been typed as interfaces.Cache
to prevent access to the internal state in the program.
- go v1.21