Esempio n. 1
0
        public static void UpdateCacheEntry(string id, DateTime validUntil)
        {
            CacheEntry entry = null;

            using (CacheDbContext ctx = new CacheDbContext())
            {
                entry = ctx.CacheEntries.Where(e => string.Equals(e.Id, id)).FirstOrDefault();
            }
            if (entry is null)
            {
                entry = new CacheEntry
                {
                    Id         = id,
                    ValidUntil = validUntil
                };
                entry.Add();
            }
            else
            {
                entry.ValidUntil = validUntil;
                entry.Update();
            }
        }