コード例 #1
0
        public static void Set(string id, DestinationsUpdate data)
        {
            WeightedSelector <DestinationsUpdate> ws;

            if (MemoryCache.Default.Contains(id))
            {
                ws = Get(id);
                if (ws == null)
                {
                    throw new NotImplementedException("Cache 'list' is NULL");
                }

                // TODO: Fix bug where items can get added multiple times
                ws.Add(data, 1);
            }
            else
            {
                ws = new WeightedSelector <DestinationsUpdate>();
                ws.Add(data, 1);
            }

            MemoryCache.Default.Set(new CacheItem(id, ws), new CacheItemPolicy
            {
                AbsoluteExpiration = DateTimeOffset.MaxValue,
                Priority           = CacheItemPriority.NotRemovable
            });
        }
コード例 #2
0
 public static void Set(int?id, DestinationsUpdate data)
 {
     Set(id.ToString(), data);
 }