danielcrenna/depot — Issue #1: Exception: Null reference
Author: feryt
Created: 2011-12-06 10:10:31+00:00
State: open

Hi.
This code returns exception(it the item was not inserted in cache before):
var count = Cache.Get("Business.Count");

The problem is here:

public T Get(string key)
{
return (T)_cache.Get(key);
}

Should be:

public T Get(string key)
{
return _cache[key] != null ? (T) _cache.Get(key) : default(T);
}