Reference

Disabling Client-side Caching in RavenDB

While editing documents in RavenDB Management Studio for testing, it became evident that the changes were not reflected in the website that was using the database. By default, RavenDB caches client queries. This article describes how to disable this feature, should the need arise.

Tags: caching csharp database nosql ravendb server

Solution

The RavenDB client API exposes the delegate ShouldCacheRequest in the document store’s conventions for disabling caching on a per-request basis. To disable caching for all requests, use the code in the following example:

DocumentStore documentStore = new DocumentStore()
{
    Conventions =
    {
        ShouldCacheRequest = (url) => false
    }
};

The lambda expression used above simply returns false for all request URLs.

Related Resources