Documentation ¶
Overview ¶
Package cache provides cache solutions to store APISIX resources. A cache solution should support to insert, update, get, list and delete for each resources. To reduce the type assertion overheads, the cache is designed to be typed. Also, the cache should be threaded-safe.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrObjectNotFound means the target object is not found // from the cache. ErrObjectNotFound = errors.New("object not found") )
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache interface { // Route returns the route exclusive cache object. Route() Route // Upstream returns the upstream exclusive cache object. Upstream() Upstream }
Cache defines what capabilities a cache solution should provide.
func NewInMemoryCache ¶
func NewInMemoryCache() Cache
NewInMemoryCache creates a Cache object which stores all data in memory.
type Route ¶
type Route interface { // Get the apisix.Route by its id. In case of the object not found, // ErrObjectNotFound is given. Get(string) (*apisix.Route, error) // List lists all apisix.Route. List() ([]*apisix.Route, error) // Insert inserts or updates an apisix.Route object, indexed by its id. Insert(*apisix.Route) error // Delete deletes the apisix.Route object by the id. In case of object not // exist, ErrObjectNotFound is given. Delete(string) error }
Route defines the exclusive behaviors for apisix.Route.
type Upstream ¶
type Upstream interface { // Get the apisix.Upstream by its id. In case of the object not found, // ErrObjectNotFound is given. Get(string) (*apisix.Upstream, error) // List lists all apisix.Upstream. List() ([]*apisix.Upstream, error) // Insert creates or updates an apisix.Upstream object, indexed by its id. Insert(*apisix.Upstream) error // Delete deletes the apisix.Upstream object by the id. In case of object not // exist, ErrObjectNotFound is given. Delete(string) error }
Upstream defines the exclusive behaviors for apisix.Upstream.
Click to show internal directories.
Click to hide internal directories.