writing to caching layer