• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java RList类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ApplicationAttemptFinishDataPBImpl类代码示例发布时间:2022-05-23
下一篇:
Java RatioBasedCompactionPolicy类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap