This directory contains examples of using the HyperCache package. Do not use these examples in production. All the code in this directory is for demonstration purposes only.
-
Get- An example of using the HyperCache package to fetch one or more items and retrieve a single or multiple items from cache. -
List- A simple example of using the HyperCache package to store a list of items and retrieve the list filtering and sorting the results. -
Eviction- An example of using the HyperCache package to store a list of items and evict items from the cache based on several different algorithms. -
Stats- An example of using the HyperCache package to store a list of items and retrieve the cache stats. -
Clear- An example of using the HyperCache package to store a list of items and clear the cache. -
Service- An example of implementingHyperCacheServiceand register middleware. -
Redis- An example of implementing theHyperCacheinterface using Redis as the backend. It requires that you run the Redis server locally as the default configuration points tolocalhost:6379. To run the Redis server locally, use the following command:docker compose up -d -
Middleware- An example of implementing a custom middleware and register it with theHyperCacheService. -
Size- An example of using the HyperCache package to store a list of items and limit the cache based on size. -
Observability (OpenTelemetry)- Demonstrates wrapping the service with tracing and metrics middleware using OpenTelemetry. -
Distributed OIDC client (SDK)- Recommended: ~150-line consumer usingpkg/clientfor OIDC client-credentials auth, multi-endpoint failover, topology refresh, and typed errors. The path most Go integrators should follow. Seedocs/client-sdk.mdfor the full SDK reference. -
Distributed OIDC client (raw HTTP)- The hand-crafted version of the above againstnet/http— kept in the tree as a reference for what the SDK does internally and for environments that can't depend onpkg/client(non-Go consumers reading along, code-review reference, etc.).