command
Version:
v1.3.0
Opens a new window with list of versions in this module.
Published: Nov 4, 2025
License: MIT
Opens a new window with license information.
Imports: 9
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
README
¶
NATS K/V Cache Example
This example demonstrates how to use the NATS JetStream Key/Value store as a cache backend for httpcache.
Prerequisites
- NATS server with JetStream enabled
Running the Example
First, start a NATS server with JetStream:
docker run -p 4222:4222 nats:latest -js
Then run the example:
go run main.go
What This Example Does
- Connects to a local NATS server
- Creates a JetStream Key/Value bucket for caching
- Makes HTTP requests through the cache
- Demonstrates cache hits on subsequent requests
Configuration
The example connects to NATS at nats://localhost:4222. You can modify this in the code if your NATS server is running elsewhere.
Documentation
¶
There is no documentation for this package.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.