GoCache is an example of caching system for GOCACHEPROG Go 1.24 environmental variable, implemented in Go that provides a disk-based caching solution.
- https://tip.golang.org/src/cmd/go/internal/cache/
- https://tip.golang.org/src/cmd/go/internal/cache/cache.go
- https://tip.golang.org/src/cmd/go/internal/cache/prog.go
- Disk-based persistent caching
- Client-server architecture with handshake protocol
- Configurable cache directory location
- Buffered I/O for efficient data handling
- Simple and clean API
- Go 1.24 or higher
git clone [email protected]:kaskabayev/gocacheprog.git
go build -o gocache .
export GOCACHEPROG="./gocache --cache-dir PATH/TO/TEMP_FOLDER"
If no cache directory is specified, it defaults to USER_CACHE_DIR/.gocacheprog
, e.g. for MacOS it is ~/Library/Caches/...
The project is organized into several packages:
main.go
: Entry point of the application, handles initialization and configurationserver/
: Contains the server implementation for handling client requestsstorage/
: Implements the disk-based caching mechanismprotocol/
: Defines the communication protocol between client and server
Run the simple math tests using, to see the cache generation:
go test ./tests/...