explain how to work with cookies and sessions when caching