Skip to content

Instantly share code, notes, and snippets.

View xmlviking's full-sized avatar
🏠
Working from home

Eric Cotter xmlviking

🏠
Working from home
  • Dell Office of the CTO (OCTO)
  • Round Rock, Texas
View GitHub Profile
@xmlviking
xmlviking / Redis BookStack Expire extension
Last active December 24, 2015 22:19
Redis BookStack Expire extension for the Store method. Dan Parnham's BookStack provides an implementation for typed structures to be persisted, queried and removed from the Redis store. Unfortunately for me the library did not incorporate and overloaded feature in which the user could provide the Expire parameter. This version does work with his…
public static class BookStackExtensions
{
public static Task<T> Store<T>(this RedisConnection redis, int db, T entity, int expire)
{
var id = entity.GetType().GetProperty("Id").GetGetMethod().Invoke(entity, new object[0]);
return redis.Store(db, id, entity, expire);
}
public static Task<T> Store<T>(this RedisConnection redis, int db, object id, T entity, int expire)
{