.netcachingredismemcachedwrite-through

Redis extensibility for write-behind cache for .NET


Is it possible to utilize Redis to create a write-behind or write-through cache for .NET? Ideally a transparent cache which is written to by a single process and supports loading the missing data from a database, and persisting the dirty blocks every once in a while?

I have been googling for hours, perhaps by google-fu is too rusty, but I am unable to find anything similar, and yet it seems like a common scenario.

So I basically have two questions:

  1. Is there a way to extend Redis (or such implementation already exists) to make it forward dirty blocks in regular intervals or load missing blocks from a persistent store?

  2. If not, what would be the appropriate approach to implement in Redis:

    a) send a "request" functionality and wait for the data to appear in Redis (the writer process wants to update a block, so it notifies the data process to load the blocks into Redis, then waits for the blocks to appear in cache),

    b) the polling of dirty blocks in regular intervals by the data service (find dirty blocks, clear the dirty flag atomically, save to disk)?


Solution

  • Yes, Redis supports Write Behind and Write Through Cache via RGSync, which is a RedisGears recipe. Check out the demo here.

    Other links, depending on whether you are using Enterprise or OpenSource version: https://docs.redislabs.com/latest/modules/redisgears/

    https://redis.io/modules