Strategy
-
Identify the most frequently accessed data
-
Identity the data that requires low latency access
-
Identify the data that are computationally expensive to generate
-
Deploy cache where data like above is accessed
-
Determine the time to live (TTL) for cached data
-
Choose the right cache type
-
Application in-memory cache
Local to instance, fast but not consistent across instances
Caffeine, Cache2k, etc.
-
Distributed cache
Shared across instances ensuring consistency
Redis, Memcached, etc.
-
CDN / Edge Cache
For static assets, closer to users
-