Example usage for org.springframework.data.redis.support.collections RedisSet expire

List of usage examples for org.springframework.data.redis.support.collections RedisSet expire

Introduction

In this page you can find the example usage for org.springframework.data.redis.support.collections RedisSet expire.

Prototype

@Nullable
Boolean expire(long timeout, TimeUnit unit);

Source Link

Document

Sets the key time-to-live/expiration.

Usage

From source file:com.afousan.service.RetwisRepository.java

public List<String> commonFollowers(String uid, String targetUid) {
    RedisSet<String> tempSet = following(uid).intersectAndStore(following(targetUid),
            KeyUtils.commonFollowers(uid, targetUid));

    tempSet.expire(5, TimeUnit.SECONDS);

    return covertUidsToNames(tempSet.getKey());
}