C# small caching API 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;
{
    protected static Dictionary&lt;Guid, Dictionary&lt;TK, TV&gt;&gt; data = new Dictionary&lt;Guid, Dictionary&lt;TK, TV&gt;&gt;();
    private Guid StorageNameSpage;

    protected BaseCache(Guid storageNameSpage)
    {
        StorageNameSpage = storageNameSpage;
    }

    protected BaseCache()
    {
        StorageNameSpage = Guid.NewGuid();
    } 



    public TV Get(TK key)
    {
        return data[StorageNameSpage][key];
    }

    public void Add(TK key, TV val)
    {
        data.Add(....);
     }
}


2 different ways to implement it:

"mulityTon" or what ever you want to call it.

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

}


SingleTome

public class KeyValCacheStorageSingleTon&lt;TK, TV&gt; : BaseCache&lt;TK, TV&gt;, ICacheable&lt;TK, TV&gt;
{
    private static Guid storageNameSpage = Guid.NewGuid();
    public KeyValCacheStorageSingleTon():base(storageNameSpage)
    {

    }
}


usage:

KeyValCacheStorageSingleTon&lt;string, string&gt; storageSingleTon1 = new KeyValCacheStorageSingleTon&lt;string, string&gt;();
storageSingleTon1.Add("storageSingleTon1", "KeyValCacheStorageSingleTon");
storageSingleTon1.Add("bla", "yada");

KeyValCacheStorageSingleTon&lt;string, string&gt; storageSingleTon2 = new KeyValCacheStorageSingleTon&lt;string, string&gt;();
storageSingleTon2.Add("storageSingleTon2", "KeyValCacheStorageSingleTon2");
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)
    {
    }
}