github.com/bartventer/gocache
Package cache offers a library for managing caches in a unified manner in Go. This package enables developers to transition between various cache implementations (such as Redis, Redis Cluster, Memcache, etc.) by altering the URL scheme. This is achieved by offering consistent, idiomatic interfaces for common operations. Central to this package are "portable types", built atop service-specific drivers for supported cache services. For instance, the GenericCache type is a portable type that implements the driver.Cache interface. This allows developers to use the same code with different cache implementations. The cache package uses URLs to specify cache implementations. The URL scheme is used to determine the cache implementation to use. The URL format is: The scheme is used to determine the cache implementation. The host and port are used to connect to the cache service. The optional query parameters can be used to configure the cache implementation. Each cache implementation supports different query parameters. To use a cache implementation, import the relevant driver package and use the OpenCache function to create a new cache. The cache package will automatically use the correct cache implementation based on the URL scheme. For specific URL formats, query parameters, and examples, refer to the documentation of each cache implementation. The cache package supports any string-like type for keys. Custom key types can be used by registering it alongside the cache implementation with RegisterCache. This allows the cache package to automatically convert the custom key type to a string when interacting with the cache. The following key types are supported by default: For an example of how to register a custom key type, refer to the redis driver package.
proxy.golang.org
v1.15.0
over 1 year ago
44
Links
| Registry | proxy.golang.org |
| Source | Repository |
| Docs | Documentation |
| JSON API | View JSON |
| CodeMeta | codemeta.json |
Package Details
Repository
| Stars | 0 on GitHub |
| Forks | 0 on GitHub |