コード例 #1
0
    public static List <T> GetList <T>(Expression <Func <T, bool> > predicate) where T : ICacheable
    {
        // try to load from cache
        var objList = CacheStore <T> .GetObjects(predicate);

        if (objList == null)
        {
            // cache does not contains objects, load from db
            objList = DbStore <T> .GetDbObjects(predicate);

            // store in cache
            CacheStore <T> .StoreObjects(objList, predicate);
        }
        return(objList);
    }