Пример #1
0
        public CasValue <T> GetWithCas <T>(string key, params object[] values)
        {
            CasValue <T> result = null;
            var          cas    = MemClient.GetWithCas <string>(CheckKey(key, values));

            if (cas.StatusCode == 0 && cas.Result != null)
            {
                result        = new CasValue <T>();
                result.Cas    = cas.Cas;
                result.Result = cas.Result.FromJsonString <T>();
            }
            return(result);
        }
Пример #2
0
        public CasValue <bool> SetWithCas(string key, object data, TimeSpan validFor, ulong cas, params object[] values)
        {
            CasValue <bool> result = new CasValue <bool>();

            if (data == null)
            {
                result.Result = false;
                return(result);
            }
            var setCas = MemClient.Cas(StoreMode.Set, CheckKey(key, values), data.ToJsonString(), validFor, cas);

            if (setCas.StatusCode == 0)
            {
                result        = new CasValue <bool>();
                result.Result = setCas.Result;
                result.Cas    = setCas.Cas;
            }
            return(result);
        }