Skip to content

Latest commit

 

History

History
29 lines (16 loc) · 2.42 KB

File metadata and controls

29 lines (16 loc) · 2.42 KB

HyperCache Examples

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.

  1. Get - An example of using the HyperCache package to fetch one or more items and retrieve a single or multiple items from cache.

  2. List - A simple example of using the HyperCache package to store a list of items and retrieve the list filtering and sorting the results.

  3. 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.

  4. Stats - An example of using the HyperCache package to store a list of items and retrieve the cache stats.

  5. Clear - An example of using the HyperCache package to store a list of items and clear the cache.

  6. Service - An example of implementing HyperCacheService and register middleware.

  7. Redis - An example of implementing the HyperCache interface using Redis as the backend. It requires that you run the Redis server locally as the default configuration points to localhost:6379. To run the Redis server locally, use the following command: docker compose up -d

  8. Middleware - An example of implementing a custom middleware and register it with the HyperCacheService.

  9. Size - An example of using the HyperCache package to store a list of items and limit the cache based on size.

  10. Observability (OpenTelemetry) - Demonstrates wrapping the service with tracing and metrics middleware using OpenTelemetry.

  11. Distributed OIDC client (SDK) - Recommended: ~150-line consumer using pkg/client for OIDC client-credentials auth, multi-endpoint failover, topology refresh, and typed errors. The path most Go integrators should follow. See docs/client-sdk.md for the full SDK reference.

  12. Distributed OIDC client (raw HTTP) - The hand-crafted version of the above against net/http — kept in the tree as a reference for what the SDK does internally and for environments that can't depend on pkg/client (non-Go consumers reading along, code-review reference, etc.).