예제 #1
0
 private bool IsExpired <T>(CacheData <T> data)
 {
     return(data == null || DateTime.Now > data.CreatedAt.AddMinutes(data.TtlMinutes));
 }
예제 #2
0
        private void Store <TK, TV>(TK key, TV value, long ttlMins = 24 * 60 * 7 * 4) // A month
        {
            CacheData <TV> data = new CacheData <TV>(ttlMins, value);

            File.WriteAllText(GetPath(key.ToString()), JsonConvert.SerializeObject(data));
        }