Memcached and Redis are popular Cache Server, they have API which can be interacted with programming languages
# The cached data has a key 'myKey', and value 'hi there'# The cached data will stay in the Cacahe server for 3600sSECONDS = 1cache.set('myKey, 'hi there', 3600 * SECONDS)cache.get('myKey')
Use Cache Server when data is read frequently but modified infrequently
Cached data is stored in Main Memory. Thus, a cache server is not ideal for persisting data
Expiration policy
It is a good practice to set how long it takes for the cached data to expire and get removed from Cache Server. Or cached data will stay in the Main Memory forever
Not to make the expiration date too short as this will cause the system to reload data from the Database too frequently
Not to make the expiration date too long as the data can become stale