Using the Redis NoSql database with .NET Part 18: Redis as a cache engine in .NET
May 12, 2017 Leave a comment
Introduction
In the previous post we looked briefly at data persistence in Redis. We know that the principal storage for Redis is the memory. It also offers two modes of persistence. The first option is called snapshotting which means that the database is saved to disk periodically. The periodicity can be configured in the Redis config file and we can define multiple options depending on the number of new items in memory. The drawback of snapshotting is that if the Redis service abruptly goes down then some unsaved data in memory will be lost. If you cannot afford any data loss then the append-only persistence mode can be for you. It saves the commands in an append-only file which is processed when Redis starts up to restore the database based on the saved commands. Note that append-only will make write operations slower.
In this post we’ll look at caching in the ServiceStack.Redis client. This post also concludes the series on Redis with .NET.