Skip to content

matthiasmullie/cacher

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cacher

TravisCI GoDoc reference

Cacher is a port of the PHP a library Scrapbook.

It defines an interface to interact with several cache systems without having to worry about the implementation of said cache layer.

Methods

Add(key string, value interface{}, ttl int) bool

Adds a new key to the cache if the key is not already stored. If the key is already stored false will be returned.

Set(key string, value interface{}, ttl int) bool

Sets the value for the specified key, regardless of wether or not the key has already been set. If the key has already been set, it will overwrite the previous value.

Get(key string) interface{}

Gets the value for the given key.

Flush() bool

Resets the cache store and deletes all cached values.

Implementations

MemoryCache

MemoryCache stores all the data in memory. This is a non persistent cache store that will be flushed every time the application that uses the cache is terminates.

This cache is perfect to use for testing. There are no other dependencies required other than enough available memory.

About

A caching interface for Golang that uniforms different caching strategies.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 100.0%