WritetoStorage() public static method

public static WritetoStorage ( string key, byte value, string filelocation ) : void
key string
value byte
filelocation string
return void
Exemplo n.º 1
0
        static public void Insert <T>(string key, T value, string filelocation)
        {
            Interlocked.Increment(ref Cache.counter);
            SimpleObject simpleObject = new SimpleObject {
                Key = key, Value = value, FileLocation = filelocation
            };

            sendQueue.Add(simpleObject);
            var data = sendQueue.Take(); //this blocks if there are no items in the queue.

            //Add to cache
            lock (Cache.LockObject)
            {
                Cache.CacheDic[filelocation + key] = simpleObject;
            }

            ThreadPool.QueueUserWorkItem(state =>
            {
                lock (Cache.LockObject)
                {
                    Storage.WritetoStorage(data.Key, Compress.CompressGZip(ConvertHelper.ObjectToByteArray(value)),
                                           data.FileLocation);
                }
            });
        }
Exemplo n.º 2
0
        public static void Insert <T>(string key, T value, string filelocation)
        {
            Interlocked.Increment(ref Cache.counter);
            SimpleObject simpleObject = new SimpleObject {
                Key = key, Value = value, FileLocation = filelocation
            };

            //Add to cache
            Cache.CacheDic[filelocation + key] = simpleObject;
            ThreadPool.QueueUserWorkItem(
                state =>
                Storage.WritetoStorage(simpleObject.Key, Compress.CompressGZip(ConvertHelper.ObjectToByteArray(value)),
                                       simpleObject.FileLocation));
        }