Exemplo n.º 1
0
        protected IStoreOperationResult Store(StoreMode mode = StoreMode.Set, string key = null, string value = null)
        {
            if (string.IsNullOrEmpty(key))
            {
                key = GetUniqueKey("store");
            }

            if (value == null)
            {
                value = GetRandomString();
            }
            return(_Client.ExecuteStore(mode, key, value));
        }
Exemplo n.º 2
0
        public static IStoreOperationResult Store(ICouchbaseClient client, StoreMode mode = StoreMode.Set, string key = null, string value = null)
        {
            if (string.IsNullOrEmpty(key))
            {
                key = GetUniqueKey("store");
            }

            if (value == null)
            {
                value = GetRandomString();
            }
            return(client.ExecuteStore(mode, key, value));
        }
Exemplo n.º 3
0
        public static Tuple <bool, int, string> StoreDictionary(
            this ICouchbaseClient client,
            StoreMode storeMode,
            string key,
            Dictionary <string, object> dictionary)
        {
            var json   = JsonConvert.SerializeObject(dictionary);
            var result = client.ExecuteStore(storeMode, key, json);

            if (!result.Success)
            {
                if (result.Exception != null)
                {
                    throw result.Exception;
                }

                return(Tuple.Create(false, result.StatusCode.HasValue ? result.StatusCode.Value : -1, result.Message));
            }

            return(Tuple.Create(true, 0, string.Empty));
        }
        public static bool StoreJson(this ICouchbaseClient client, StoreMode mode, string key, object value, DateTime expiresAt)
        {
            var json = SerializeObject(value);

            return(client.ExecuteStore(mode, key, json, expiresAt).Success);
        }
        public static IStoreOperationResult ExecuteStoreJson(this ICouchbaseClient client, StoreMode mode, string key, object value, DateTime expiresAt)
        {
            var json = SerializeObject(value);

            return(client.ExecuteStore(mode, key, json, expiresAt));
        }
        public static IStoreOperationResult ExecuteStoreJson(this ICouchbaseClient client, StoreMode mode, string key, object value, PersistTo persistTo, ReplicateTo replicateTo = ReplicateTo.Zero)
        {
            var json = SerializeObject(value);

            return(client.ExecuteStore(mode, key, json, persistTo, replicateTo));
        }
        public static bool StoreJson(this ICouchbaseClient client, StoreMode mode, string key, object value, TimeSpan validFor)
        {
            var json = SerializeObject(value);

            return(client.ExecuteStore(mode, key, json, validFor).Success);
        }
Exemplo n.º 8
0
        public static IStoreOperationResult Store(ICouchbaseClient client, StoreMode mode = StoreMode.Set, string key = null, string value = null)
        {
            if (string.IsNullOrEmpty(key))
            {
                key = GetUniqueKey("store");
            }

            if (value == null)
            {
                value = GetRandomString();
            }
            return client.ExecuteStore(mode, key, value);
        }
        public static IStoreOperationResult ExecuteStoreJson(this ICouchbaseClient client, StoreMode mode, string key, object value, TimeSpan validFor)
        {
            var json = serializeObject(value);

            return(client.ExecuteStore(mode, key, json, validFor));
        }