/*
* Copyright 2011-2018 the original author or authors.
*
* Licensed 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.springframework.data.redis.core;
import java.util.Collection;
import java.util.List;
import java.util.Set;
import org.springframework.lang.Nullable;
/**
* Redis set specific operations.
*
* @author Costin Leau
* @author Christoph Strobl
* @author Mark Paluch
*/
public interface SetOperations<K, V> {
/**
* Add given {@code values} to set at {@code key}.
*
* @param key must not be {@literal null}.
* @param values
* @return {@literal null} when used in pipeline / transaction.
* @see <a href="http://redis.io/commands/sadd">Redis Documentation: SADD</a>
*/
@Nullable
Long add(K key, V... values);
/**
* Remove given {@code values} from set at {@code key} and return the number of removed elements.
*
* @param key must not be {@literal null}.
* @param values
* @return {@literal null} when used in pipeline / transaction.
* @see <a href="http://redis.io/commands/srem">Redis Documentation: SREM</a>
*/
@Nullable
Long remove(K key, Object... values);
/**
* Remove and return a random member from set at {@code key}.
*
* @param key must not be {@literal null}.
* @return {@literal null} when used in pipeline / transaction.
* @see <a href="http://redis.io/commands/spop">Redis Documentation: SPOP</a>
*/
@Nullable
V pop(K key);
/**
* Remove and return {@code count} random members from set at
Redis进阶之四:StringRedisTemplate的opsForSet Api梳理和应用
最新推荐文章于 2024-04-26 23:01:12 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)