All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.nervousync.cache.provider.Provider Maven / Gradle / Ivy

/*
 * Licensed to the Nervousync Studio (NSYC) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.nervousync.cache.provider;

/**
 * @author Steven Wee	[email protected]
 * @version $Revision: 1.0 $ $Date: 9/14/2020 10:30 AM $
 */
public interface Provider {

	/**
	 * 

Set key-value to cache server and set expire time

*

使用指定的过期时间设置缓存信息

* * @param key Cache key * 缓存键值 * @param value Cache value * 缓存数据 * @param expiry Expire time * 过期时间 */ void set(String key, String value, int expiry); /** *

Add a new key-value to cache server and set expire time

*

使用指定的过期时间添加缓存信息

* * @param key Cache key * 缓存键值 * @param value Cache value * 缓存数据 * @param expire Expire time * 过期时间 */ void add(String key, String value, int expire); /** *

Replace exists value of given key by given value and set expire time

*

使用指定的过期时间替换已存在的缓存信息

* * @param key Cache key * 缓存键值 * @param value Cache value * 缓存数据 * @param expire Expire time * 过期时间 */ void replace(String key, String value, int expire); /** * Operate touch to given keys * @param keys Keys */ void touch(String... keys); /** *

Remove cache key-value from cache server

*

移除指定的缓存键值

* * @param key Cache key * 缓存键值 */ void delete(String key); /** *

Read cache value from cache key which cache key was given

*

读取指定缓存键值对应的缓存数据

* * @param key Cache key * 缓存键值 * @return Cache value or null if cache key was not exists or it was expired * 读取的缓存数据,如果缓存键值不存在或已过期,则返回null */ String get(String key); /** *

Increment data by given cache key and value

* * @param key Cache key * 缓存键值 * @param step Increment step value * 自增步进值 * @return Operate result * 操作结果 */ long incr(String key, long step); /** *

Decrement data by given cache key and value

* * @param key Cache key * 缓存键值 * @param step Decrement step value * 自减步进值 * @return Operate result * 操作结果 */ long decr(String key, long step); /** *

Destroy agent instance

*

销毁缓存对象

*/ void destroy(); }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy