Gothic Framework G symbol

In Memory Cache

The IN_MEMORY strategy stores cached pages and API responses in a Go in-memory map protected by a read-write mutex. It supports TTL-based expiration and optional compression (GZIP or BROTLI).

This strategy is fast and has zero external dependencies, but the cache is lost on restart. It is great for local development and single-instance self-hosted deployments.

Note: During development (GOTHIC_MODE=dev), the framework automatically uses IN_MEMORY as the local cache and flushes it on startup for hot-reload freshness. You can override this with the LocalDevelopmentCache field.

gothicRoutes. Setup (router, gothicRoutes. AppConfig {
	 CacheStrategy:    gothicRoutes. IN_MEMORY ,
	 ServeStaticFiles: gothicRoutes. ALL_ENVS ,
 }, routes.RegisterFileBasedRoutes) 

To enable compression and reduce memory usage, add a CacheConfig:

gothicRoutes. Setup (router, gothicRoutes. AppConfig {
	 CacheStrategy:    gothicRoutes. IN_MEMORY ,
	 ServeStaticFiles: gothicRoutes. ALL_ENVS ,
	 CacheConfig: &gothicRoutes. CacheConfig {
		 Compression:        true ,
		 CompressionMethod: gothicRoutes. BROTLI ,
	},
 }, routes.RegisterFileBasedRoutes) 

Need cache that persists across restarts and can be shared between instances? Check out the Redis cache strategy!