Exemple #1
0
        private object get(string command, string key, bool keyIsChecked, uint hash, out ulong unique)
        {
            if (!keyIsChecked)
            {
                checkKey(key);
            }
            unique = 0;
            if (memcachedProvider == null)
            {
                ConnectionError();
                return(null);
            }

            object value;

            try
            {
                List <GetOpResult> opResult = memcachedProvider.Get(new[] { key });

                if (opResult.Count == 0)
                {
                    return(null);
                }
                else
                {
                    SerializedType type = (SerializedType)Enum.Parse(typeof(SerializedType), opResult[0].Flag.ToString());
                    try
                    {
                        value  = Serializer.DeSerialize((byte[])opResult[0].Value, type);
                        unique = Convert.ToUInt64(opResult[0].Version);
                    }
                    catch (Exception e)
                    {
                        //If deserialization fails, return null
                        value = null;
                        logger.Error("Error deserializing object for key '" + key + "' of type " + type + ".", e);
                    }
                }
            }
            catch (InvalidArgumentsException e)
            {
                logger.Error("CLIENT_ERROR bad command line format", e);
                value = null;
            }
            catch (CacheRuntimeException e)
            {
                value = null;
                logger.Error("SERVER_ERROR", e);
            }
            return(value);
        }
Exemple #2
0
 public override void Execute(IMemcachedProvider cacheProvider)
 {
     if (this._errorMessage != null)
         return;
     _getResult = cacheProvider.Get(_keys);
     this.OperationResult = new OperationResult();
     this.OperationResult.ReturnResult = Result.SUCCESS;
 }
Exemple #3
0
 public override void Execute(IMemcachedProvider cacheProvider)
 {
     if (this._errorMessage != null)
     {
         return;
     }
     _getResult           = cacheProvider.Get(_keys);
     this.OperationResult = new OperationResult();
     this.OperationResult.ReturnResult = Result.SUCCESS;
 }