Cache Solution for Dapper Using Stored Procedures (MSSQL)

I use Dapper mainly to call stored procedures in the MSSQL 2008 R2 database. I have no classes that map to database tables. Most of the data ends in IEnumerable <Dynamic> and is passed to the grid on the screen.

Is there a ready-to-use data buffering solution that I could use? (I need to use it in MVC).

The data in the database is both static and dynamic in nature. I am using a repository model to access data.

+4
source share
1 answer

Dapper does not include built-in data caching features (although it uses extensive caching for the metaprogramming layer): it focuses entirely on ADO.NET stuff - however you can use almost any -shelf, including the HTTP runtime cache ( HttpContext.Current.Cache ) or newer versions of ObjectCache , etc. Since they just take objects, they should work fine.

If you use distributed cache (possibly through app-fabric, redis or memcached), you need data to serialize. In this case, I highly recommend using formal POCO types for binding, rather than the dynamic API. As an example, we use dapper to populate POCOs, which are annotated with protobuf-net markers for serialization, and stored through BookSleeve for redis. Which sounds more complicated than it really is.

+5
source

All Articles