Spruce and CacheStack

Spruce

I recently created a library that compliments the fantastic Dapper library. I called my library Spruce as a play on the word dapper. The spruce library contains a set of extension methods that simplify querying and saving. When I’m in working in .net land, I primarily use MS Sql server 2008+, so that is what the library is written against. Until I have a need (or get a pull request), I don’t have plans to extend the library to support other databases.

In addition to the querying and saving extensions, Spruce also includes sql schema helpers and a basic migration framework. The migration framework is a simple forward-only (no rollbacks) code based migrations. There are a number of attributes, that can be added to your POCO classes, to define the basic schema for your data. To complement the attributes, Spruce offers a set of extensions specifically for manipulating sql schemas. There are extensions ranging from creating and dropping tables to column schema manipulation. The migration framework ensures that your schema is always where you want it. In cases where there isn’t an extension to accomplish the migration that you need, you can always run the raw sql script via Db.Execute().

Spruce is available as a nuget and is also available on github. There is detailed example usage available at the project’s github page. If you’re interested in seeing Spruce in a real-world project, it is being used with the MvcKickstart project.

 

CacheStack

The other library that I recently created is all about caching. It’s called CacheStack and compliments ServiceStack’s ICacheClient. CacheStack extends typical caching scenarios with the notion of a cache context, allowing you to clear cache items without knowing the specific cache keys. You’re able to setup listeners for the items that you cache and have those cache items invalidate when one of the items you’re listening to fires a trigger. The cache context supports cache profiles that can be defined any way you prefer, be it database, config files, etc. CacheStack also includes a modified version of MvcDonutCaching. My version of donut caching has some bugfixes, performance improvements, and uses ICacheClient for persistence. The really cool part is that you can leverage all of the features of a cache context when using donut caching. This makes it very trivial to clear the output cache of an action, when a model object is updated.

CacheStack is available as a nuget and is also available on github. Like Spruce, there is detailed example usage available on the project’s github page. CacheStack will be incorporated into MvcKickstart in the near future.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.