Dewy Cache Implementations: Available Backends and Configuration Options

Dewy provides four cache implementations through its KVS interface, with only the File system backend currently functional while Memory, Consul, and Redis remain planned features.

Dewy abstracts artifact caching behind a KVS (Key‑Value Store) interface that supports pluggable backends. The linyows/dewy repository currently ships with one fully operational implementation and three storage stubs designed for future distributed deployments. Understanding these cache implementations helps operators select the appropriate persistence strategy for their deployment environment.

Available Cache Implementations in Dewy

Dewy’s caching layer is defined in the kvs/ directory of the repository. Each implementation adheres to the common KVS interface, allowing seamless backend swaps without changing deployment logic.

File System Cache (Production Ready)

The File cache is the only fully implemented backend, defined in [kvs/file.go](https://github.com/linyows/dewy/blob/main/kvs/file.go). This implementation persists artifacts on the local filesystem with the following capabilities:

  • Automatic creation of persistent cache directories
  • Archive extraction for compressed artifacts
  • Size‑limiting and cleanup mechanisms
  • Default behavior when no specific backend is configured

This backend suits single‑instance deployments or scenarios where local disk persistence is sufficient.

Memory Cache (Planned)

Defined in [kvs/memory.go](https://github.com/linyows/dewy/blob/main/kvs/memory.go), the Memory implementation remains a stub marked as "Not Implemented". When completed, this backend will provide high‑speed, volatile caching where data resides entirely in RAM and is lost on process restart. This suits ephemeral deployment environments requiring maximum read performance without persistence guarantees.

HashiCorp Consul Cache (Planned)

The Consul backend, stubbed in [kvs/consul.go](https://github.com/linyows/dewy/blob/main/kvs/consul.go), will enable distributed caching across multiple Dewy instances. This implementation targets deployments requiring shared cache state between server clusters, allowing artifact storage in HashiCorp’s distributed KV store rather than local filesystems.

Redis Cache (Planned)

Located in [kvs/redis.go](https://github.com/linyows/dewy/blob/main/kvs/redis.go), the Redis implementation is planned to provide high‑performance, distributed caching with TTL support. According to the documentation in [docs/pages/cache.md](https://github.com/linyows/dewy/blob/main/docs/pages/cache.md), this backend will support the redis:// protocol scheme for connection strings, enabling centralized cache management for horizontally scaled Dewy deployments.

Configuring the File Cache

Since the File cache is currently the only functional implementation, Dewy uses it by default without requiring explicit configuration.

To use the default cache location:

dewy := dewy.New()
dewy.Start() // artifacts cached under ./.dewy/cache or $DEWY_CACHEDIR

To override the cache directory location, set the DEWY_CACHEDIR environment variable:

export DEWY_CACHEDIR=/var/cache/dewy
dewy server --registry ghr://owner/repo -- /opt/myapp/current/myapp

This directs all artifact storage to the specified path instead of the default .dewy/cache directory.

Future Cache Configuration Syntax

While the distributed backends remain unimplemented, the CLI syntax is planned to support URI‑style cache specifications. For example, selecting Redis (when available) would use:

dewy server --registry ghr://owner/repo \
  --cache redis://localhost:6379 \
  -- /opt/myapp/current/myapp

Currently, attempting to use these planned backends results in an error until the respective implementations in kvs/redis.go, kvs/consul.go, or kvs/memory.go are completed.

Summary

  • Four cache implementations are defined in the Dewy KVS interface: File, Memory, Consul, and Redis.
  • Only the File system cache in kvs/file.go is fully implemented and production‑ready.
  • Memory, Consul, and Redis backends exist as interface stubs in kvs/memory.go, kvs/consul.go, and kvs/redis.go respectively.
  • The File cache supports automatic directory creation, archive extraction, and size limiting.
  • Use the DEWY_CACHEDIR environment variable to customize the File cache location.

Frequently Asked Questions

Which cache implementation is currently functional in Dewy?

Only the File system cache is fully implemented and operational. The Memory, Consul, and Redis implementations exist as placeholder stubs in their respective kvs/ files but lack functional code. The File backend handles artifact persistence, extraction, and cleanup automatically.

How do I change the cache directory location?

Set the DEWY_CACHEDIR environment variable to an absolute path before starting Dewy. For example, export DEWY_CACHEDIR=/var/cache/dewy redirects all artifact storage from the default ./.dewy/cache to your specified directory. This works exclusively with the File cache implementation.

Will Dewy support distributed caching across multiple servers?

Yes, distributed caching is planned through the Consul and Redis backends defined in kvs/consul.go and kvs/redis.go. These implementations will allow multiple Dewy instances to share cache state via centralized key‑value stores, though neither backend is currently functional.

What is the KVS interface in Dewy?

The KVS (Key‑Value Store) interface is the abstraction layer that allows Dewy to swap cache backends without modifying core deployment logic. All four cache implementations—File, Memory, Consul, and Redis—implement this common interface defined in the kvs package, ensuring consistent read, write, and delete operations regardless of the underlying storage mechanism.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →