This is a Go WebAPI application featuring an in-memory cache implementation. This exercise is part of a code assessment for Minerva.
It implements an HTTP WebAPI application with an in-memory cache that can hold a maximum of 255 keys, satisfying the interface provided below.
gotype (
Cacheinterface {
// Set sets the value to the provided key in the given bucket.// Applying any provided options during the operation.// An error is returned if operation fails.Set(bucketstring, keystring, value []byte, opts...Option) error// Get returns the value associated with the given key in the bucket.// Applying any provided options during the operation.// An error is returned if operation fails.Get(bucket, keystring, opts...Option) ([]byte, error)
// Delete removes the key and value from the bucket.// Applying any provided options during the operation.// An error is returned if operation fails.Delete(bucket, keystring, opts...Option) error
}
Optionsstruct {
ttl time.Duration// evictionPolicy controls how keys should be removed from the cache.// Options: Oldest, Newest, LRU, MRUevictionPolicystring
}
Optionfunc(oOptions) error
)