C# small caching API
So I've made a few modifications; here are the explanations:


Used interfaces a bit more liberally (IDictionary)
Made BaseClass implement ICacheable so the subclasses don't explicitly have to
Made fields readonly as appropriate to declare intent
Made field data private and exposed as protected by way of a property
Chained the BaseCache constructors
Created the storage dictionary in the constructor (could do this in Add if you were looking for lazy creation)
sealed subclasses (if they're intended to be non-inheritable, of course)


The code:

public interface ICacheable&lt;TK, TV&gt;
{
    TV Get(TK key);

    void Add(TK key, TV val);
}

public abstract class BaseCache&lt;TK, TV&gt; : ICacheable&lt;TK, TV&gt;
{
    private static readonly IDictionary&lt;Guid, IDictionary&lt;TK, TV&gt;&gt; data = new Dictionary&lt;Guid, IDictionary&lt;TK, TV&gt;&gt;();

    private readonly Guid storageNameSpace;

    protected BaseCache(Guid storageNameSpace)
    {
        this.storageNameSpace = storageNameSpace;
        data[this.storageNameSpace] = new Dictionary&lt;TK, TV&gt;();
    }

    protected BaseCache() : this (Guid.NewGuid())
    {
    }

    protected static IDictionary&lt;Guid, IDictionary&lt;TK, TV&gt;&gt; Data
    {
        get
        {
            return data;
        }
    }

    public TV Get(TK key)
    {
        return data[this.storageNameSpace][key];
    }

    public void Add(TK key, TV val)
    {
        data[this.storageNameSpace].Add(key, val);
    }
}

public sealed class KeyValCacheStorage&lt;TK, TV&gt; : BaseCache&lt;TK, TV&gt;
{
}

public sealed class KeyValCacheStorageSingleton&lt;TK, TV&gt; : BaseCache&lt;TK, TV&gt;
{
    private static readonly Guid storageNameSpace = Guid.NewGuid();

    public KeyValCacheStorageSingleton() : base(storageNameSpace)
    {
    }
}