View on GitHub
This library is an
IDistributedCache implementation for use in ASP.NET Core applications that uses RethinkDB for its backing data store.
How to Get It
The package is on NuGet; install it via the command-line or the graphical interface of your favorite IDE.
How to Use It
Ensure You Have a RethinkDB Connection
The caching provider does not try to obtain its own RethinkDB connection; it must be provided to it when it is registered. RethinkDB is well supported in .NET, in both C# and F#. The remainder of the examples assume that you have a configured
IConnection object named
Quick Start in C#
using RethinkDB.DistributedCache; // within ASP.NET Core service configuration builder.Services.AddDistributedRethinkDBCache(opts => opts.Connection = conn);
Quick Start in F#
open RethinkDB.DistributedCache // within ASP.NET Core service configuration let _ = builder.Services.AddDistributedRethinkDBCache(fun opts -> opts.Connection <- conn)
In addition to
Connection, there are four other options you can configure.
Databaseis the name of the database where the cache table will be stored. If it is not specified, the provider will use the connection's default database.
TableNameis the table for the cache; if it is not specified, the provider will use the “Cache” table. (The provider ensures that the table and its indexes exist; you do not need to create them beforehand, unless the connection is restricted from creating tables and indexes.)
DeleteExpiredIntervalcontrols how frequently expired cache entries will be purged; it is a
TimeSpanand defaults to 30 minutes.
DefaultSlidingExpirationcontrols how frequently a cache entry with “sliding” expiration must be accessed to remain valid. With sliding expiration, every time a cache entry is accessed, the expiration is pushed out by this amount. It is also a
TimeSpanand defaults to 20 minutes.
How to Improve It
If you have ideas for improving this project, feel free to open up an issue and let us know!