Caching Strategy
Quick summary
- Default:
LOCAL(in-process memory TTL cache). No extra setup required. REDIS,BUNGEECORDandDATABASEare available for cross-server or durable caching.
Config key
caching-strategy(in the mainconfig.yml)- Type:
string - Allowed values:
LOCAL,REDIS,BUNGEECORD,DATABASE - Default:
LOCAL
- Type:
If caching-strategy is not present the plugin will fall back to locking-strategy for backward compatibility.
When to use which
LOCAL: Single-server or lightweight setups. Uses an in-memoryExpiringCachewith per-entry TTLs. Best performance and simplest to operate, but caches are not shared across servers and consume JVM memory.REDIS: Use when multiple server instances should share cache state. Requires theezeconomy-redisextension and a workingredis.ymlconfiguration. Offers low-latency shared cache and eviction/TTL semantics provided by Redis.BUNGEECORD: Use when the proxy should act as the canonical cache holder. Servers forward cache requests via plugin messaging to the proxy-side store. Requires the proxy component (ezeconomy-bungeecord-proxy) andbungeecord.ymlconfiguration.DATABASE: Use when you prefer using the database as a cache backend (e.g., small networks without Redis). The plugin stores entries in theezeconomy_cachetable with TTL metadata; this has higher latency than Redis but requires no extra runtime services.
Behavior & safety
- TTL model: entries are stored with an expiry timestamp; expired entries may be returned briefly while an asynchronous refresh is scheduled (“stale-while-revalidate” behavior) to avoid blocking reads.
- Local provider: unbounded by default — monitor memory usage on high-load servers and consider eviction strategies if needed.
- Redis provider: relies on
redis.ymlfor host/port/auth and honorsfallback-to-localif Redis is unavailable. - Bungee provider: plugin-messaging packets carry values and expiry; ensure the proxy’s shared-secret (if configured) matches between proxy and servers.
- Database provider: uses SQL
REPLACE/INSERTsemantics and a simpleexpires_atcolumn; keep in mind higher IO and possible contention under heavy load. - Do not store sensitive or large binary blobs in the cache. The cache stores stringified values; ensure consistent serialization across providers.
How to enable
Local (default)
No action required. Set caching-strategy: LOCAL in config.yml (or omit the key).
Redis
- Install the optional extension
ezeconomy-redis.jarintoplugins/EzEconomy/libs/. - Configure
redis.ymlin the plugin data folder (host/port/password/database,enabled: true). - Set
caching-strategy: REDISinconfig.ymland restart.
Bungeecord (proxy-backed)
- Deploy the proxy component
ezeconomy-bungeecord-proxyon your Bungee/Waterfall proxy. - Configure
bungeecord.ymlon each server and the proxy, includingchannelandshared-secretif used. - Set
caching-strategy: BUNGEECORDinconfig.ymland restart servers and proxy.
Database
- Ensure your chosen storage provider (MySQL/SQLite) is configured and accessible.
- The plugin will create/use an
ezeconomy_cachetable; confirm DB user has appropriate privileges. - Set
caching-strategy: DATABASEinconfig.ymland restart.
Tips and troubleshooting
- If you change
caching-strategy, restart the plugin/server to apply the new provider. - For
REDISandBUNGEECORD, check extension/proxy logs for connection/auth errors and thefallback-to-localbehavior. - Monitor hit/miss rates and cache size for the
LOCALprovider to avoid OOM issues on busy servers.
See also
docs/configuration.md— global configuration referencedocs/redis.md— Redis extension setup and notesdocs/locking-strategy.md— related locking configuration and guidance- Source:
src/main/java/com/skyblockexp/ezeconomy/cache/CacheManager.javaandsrc/main/java/com/skyblockexp/ezeconomy/bootstrap/component/CacheComponent.java