本文整理汇总了Java中org.redisson.api.RList类的典型用法代码示例。如果您正苦于以下问题:Java RList类的具体用法?Java RList怎么用?Java RList使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RList类属于org.redisson.api包,在下文中一共展示了RList类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: main
import org.redisson.api.RList; //导入依赖的package包/类
public static void main(String[] args) throws InterruptedException {
Bench<RedissonClient> bench = new RedissonBench() {
@Override
public void executeOperation(String data, RedissonClient benchInstance, int threadNumber, int iteration,
MetricRegistry metrics) {
RList<String> list = benchInstance.getList("list_" + threadNumber);
Timer.Context time = metrics.timer("list").time();
list.add(data);
time.stop();
}
};
Benchmark benchmark = new Benchmark(bench);
benchmark.run(args);
}
开发者ID:redisson,项目名称:redisson-benchmark,代码行数:17,代码来源:ListAddBenchmark.java
示例2: put
import org.redisson.api.RList; //导入依赖的package包/类
@Override
public long[] put(int hashtableIndex, int key, long[] newArray) {
RList<Long> currentList = hashtables.get(hashtableIndex).get(key);
//append the current list with the new values
for(int i = currentList.size(); i <newArray.length ; i++){
hashtables.get(hashtableIndex).put(key,newArray[i]);
}
return newArray;
}
开发者ID:JorenSix,项目名称:Panako,代码行数:10,代码来源:RedisStorage.java
示例3: get
import org.redisson.api.RList; //导入依赖的package包/类
@Override
public long[] get(int hashtableIndex, int key) {
RList<Long> values = hashtables.get(hashtableIndex).get(key);
long[] asLongArray = new long[values.size()];
for(int i = 0 ; i<asLongArray.length ; i++){
asLongArray[i] = values.get(i);
}
return asLongArray;
}
开发者ID:JorenSix,项目名称:Panako,代码行数:10,代码来源:RedisStorage.java
示例4: loginSucceeded
import org.redisson.api.RList; //导入依赖的package包/类
/**
* Record a login success, also remove recent login failures with the same email and ip address
*
* @param email email address of successful login
* @param ipAddr IP address of requester
*/
void loginSucceeded(final String email, final String ipAddr) {
final RList<LoginAttempt> loginAttempts = redissonClient.getList(ATTEMPTS_REDIS_KEY);
loginAttempts.add(LoginAttempt.builder().email(email).ipAddr(ipAddr).success(true).build());
// remove failed attempts for this account by this ip address
loginAttempts.removeAll(loginAttempts.stream()
.filter(e -> !e.getSuccess() && e.getEmail().equals(email) && e.getIpAddr().equals(ipAddr))
.collect(Collectors.toList()));
}
开发者ID:mhaddon,项目名称:Sound.je,代码行数:16,代码来源:LoginAttemptService.java
示例5: hasExceededLoginAttempts
import org.redisson.api.RList; //导入依赖的package包/类
/**
* Has the email exceeded login attempts
*
* @param email email to check
* @return if the email exceeds login attempts
*/
public boolean hasExceededLoginAttempts(final String email) {
final RList<LoginAttempt> loginAttempts = redissonClient.getList(ATTEMPTS_REDIS_KEY);
return loginAttempts.stream()
.filter(e -> !e.getSuccess())
.filter(e -> e.getEmail().equals(email))
.filter(e -> (new DateTime()).minusMinutes(loginConfigSettings.getEmailAttemptsCooldownInMinutes()).isBefore(e.getDateTime()))
.count() > loginConfigSettings.getMaxEmailLoginAttempts();
}
开发者ID:mhaddon,项目名称:Sound.je,代码行数:16,代码来源:LoginAttemptService.java
示例6: isIPBlocked
import org.redisson.api.RList; //导入依赖的package包/类
/**
* Is this IP currently blocked
*
* @param ipAddr IP Address to check
* @return If it is blocked
*/
public boolean isIPBlocked(final String ipAddr) {
final RList<LoginAttempt> loginAttempts = redissonClient.getList(ATTEMPTS_REDIS_KEY);
return loginAttempts.stream()
.filter(e -> !e.getSuccess())
.filter(e -> e.getIpAddr().equals(ipAddr))
.filter(e -> (new DateTime()).minusMinutes(loginConfigSettings.getIpAttemptsCooldownInMinutes()).isBefore(e.getDateTime()))
.count() > loginConfigSettings.getMaxIPLoginAttempts();
}
开发者ID:mhaddon,项目名称:Sound.je,代码行数:16,代码来源:LoginAttemptService.java
示例7: testList
import org.redisson.api.RList; //导入依赖的package包/类
@Test
public void testList() throws Exception {
RList<TestClazz> list = redis.getList("list");
list.add(new TestClazz("a", 1));
LOG.info("get {}", list.get(0));
list.add(new TestClazz("b", 2));
// LOG.info("get {}", list.get(0, 1));
LOG.info("get {}", redis.getList("list"));
LOG.info("size {}", list.size());
list.delete();
}
开发者ID:dzh,项目名称:coca,代码行数:13,代码来源:TestRedisson.java
示例8: main
import org.redisson.api.RList; //导入依赖的package包/类
public static void main(String[] args) {
// connects to 127.0.0.1:6379 by default
RedissonClient redisson = Redisson.create();
RListMultimapCache<String, Integer> multimap = redisson.getListMultimapCache("myMultimap");
multimap.put("1", 1);
multimap.put("1", 2);
multimap.put("1", 3);
multimap.put("2", 5);
multimap.put("2", 6);
multimap.put("4", 7);
// set ttl = 10 seconds
multimap.expireKey("1", 10, TimeUnit.SECONDS);
RList<Integer> values1 = multimap.get("1");
RList<Integer> values2 = multimap.get("2");
boolean hasEntry = multimap.containsEntry("1", 3);
Collection<Entry<String, Integer>> entries = multimap.entries();
Collection<Integer> values = multimap.values();
boolean isRemoved = multimap.remove("1", 3);
List<Integer> removedValues = multimap.removeAll("1");
Collection<? extends Integer> newValues = Arrays.asList(5, 6, 7, 8, 9);
boolean isNewKey = multimap.putAll("5", newValues);
List<Integer> oldValues = multimap.replaceValues("2", newValues);
List<Integer> allValues = multimap.getAll("2");
long keysRemoved = multimap.fastRemove("2", "32");
redisson.shutdown();
}
开发者ID:redisson,项目名称:redisson-examples,代码行数:36,代码来源:ListMultimapCacheExamples.java
示例9: main
import org.redisson.api.RList; //导入依赖的package包/类
public static void main(String[] args) {
// connects to 127.0.0.1:6379 by default
RedissonClient redisson = Redisson.create();
RList<String> list = redisson.getList("myList");
list.add("1");
list.add("2");
list.add("3");
list.contains("1");
String valueAtIndex = list.get(3);
for (String string : list) {
// iteration through bulk loaded values
}
boolean removedValue = list.remove("1");
list.removeAll(Arrays.asList("1", "2", "3"));
list.containsAll(Arrays.asList("4", "1", "0"));
List<String> secondList = new ArrayList<>();
secondList.add("4");
secondList.add("5");
list.addAll(secondList);
// fetch all objects
List<String> allValues = list.readAll();
list.addAfter("3", "7");
list.addBefore("4", "6");
// use fast* methods when previous value is not required
list.fastSet(1, "6");
list.fastRemove(3);
redisson.shutdown();
}
开发者ID:redisson,项目名称:redisson-examples,代码行数:39,代码来源:ListExamples.java
示例10: main
import org.redisson.api.RList; //导入依赖的package包/类
public static void main(String[] args) {
// connects to 127.0.0.1:6379 by default
RedissonClient redisson = Redisson.create();
RListMultimap<String, Integer> multimap = redisson.getListMultimap("myMultimap");
multimap.put("1", 1);
multimap.put("1", 2);
multimap.put("1", 3);
multimap.put("2", 5);
multimap.put("2", 6);
multimap.put("4", 7);
RList<Integer> values1 = multimap.get("1");
RList<Integer> values2 = multimap.get("2");
boolean hasEntry = multimap.containsEntry("1", 3);
Collection<Entry<String, Integer>> entries = multimap.entries();
Collection<Integer> values = multimap.values();
boolean isRemoved = multimap.remove("1", 3);
List<Integer> removedValues = multimap.removeAll("1");
Collection<? extends Integer> newValues = Arrays.asList(5, 6, 7, 8, 9);
boolean isNewKey = multimap.putAll("5", newValues);
List<Integer> oldValues = multimap.replaceValues("2", newValues);
List<Integer> allValues = multimap.getAll("2");
long keysRemoved = multimap.fastRemove("2", "32");
redisson.shutdown();
}
开发者ID:redisson,项目名称:redisson-examples,代码行数:33,代码来源:ListMultimapExamples.java
示例11: loginFailed
import org.redisson.api.RList; //导入依赖的package包/类
/**
* Record a login failure
*
* @param email email of failed login
* @param ipAddr ip address of requester
*/
void loginFailed(final String email, final String ipAddr) {
final RList<LoginAttempt> loginAttempts = redissonClient.getList(ATTEMPTS_REDIS_KEY);
loginAttempts.add(LoginAttempt.builder().success(false).email(email).ipAddr(ipAddr).build());
}
开发者ID:mhaddon,项目名称:Sound.je,代码行数:11,代码来源:LoginAttemptService.java
注:本文中的org.redisson.api.RList类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论