当前位置: 首页>>代码示例>>Java>>正文


Java RedissonClient.getBucket方法代码示例

本文整理汇总了Java中org.redisson.api.RedissonClient.getBucket方法的典型用法代码示例。如果您正苦于以下问题:Java RedissonClient.getBucket方法的具体用法?Java RedissonClient.getBucket怎么用?Java RedissonClient.getBucket使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.redisson.api.RedissonClient的用法示例。


在下文中一共展示了RedissonClient.getBucket方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: main

import org.redisson.api.RedissonClient; //导入方法依赖的package包/类
public static void main(String[] args) {
    RedissonClient redisson = Redisson.create();
    
    RBucket<String> bucket = redisson.getBucket("test");
    bucket.set("123");
    boolean isUpdated = bucket.compareAndSet("123", "4934");
    String prevObject = bucket.getAndSet("321");
    boolean isSet = bucket.trySet("901");
    long objectSize = bucket.size();
    
    // set with expiration
    bucket.set("value", 10, TimeUnit.SECONDS);
    boolean isNewSet = bucket.trySet("nextValue", 10, TimeUnit.SECONDS);
    
    redisson.shutdown();
}
 
开发者ID:redisson,项目名称:redisson-examples,代码行数:17,代码来源:BucketExamples.java

示例2: main

import org.redisson.api.RedissonClient; //导入方法依赖的package包/类
public static void main(String[] args) {
    // connects to 127.0.0.1:6379 by default
    RedissonClient redisson = Redisson.create();
    
    RBucket<String> bucket = redisson.getBucket("test");
    bucket.set("123");
    boolean isUpdated = bucket.compareAndSet("123", "4934");
    String prevObject = bucket.getAndSet("321");
    boolean isSet = bucket.trySet("901");
    long objectSize = bucket.size();
    
    // set with expiration
    bucket.set("value", 10, TimeUnit.SECONDS);
    boolean isNewSet = bucket.trySet("nextValue", 10, TimeUnit.SECONDS);
    
    redisson.shutdown();
}
 
开发者ID:redisson,项目名称:redisson-examples,代码行数:18,代码来源:BucketExamples.java

示例3: main

import org.redisson.api.RedissonClient; //导入方法依赖的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) {
            RBucket<String> bucket = benchInstance.getBucket("bucket_" + threadNumber + "_" + iteration);
            Timer.Context time = metrics.timer("bucket").time();
            bucket.set(data);
            time.stop();
        }
    };
    
    Benchmark benchmark = new Benchmark(bench);
    benchmark.run(args);
}
 
开发者ID:redisson,项目名称:redisson-benchmark,代码行数:16,代码来源:BucketSetBenchmark.java

示例4: main

import org.redisson.api.RedissonClient; //导入方法依赖的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) {
            RBucket<Object> bucket = benchInstance.getBucket("bucket_" + threadNumber + "_" + iteration);
            Timer.Context time = metrics.timer("bucket").time();
            bucket.set(value);
            time.stop();
        }
    };
    
    Benchmark benchmark = new Benchmark(bench);
    benchmark.run(args);
}
 
开发者ID:redisson,项目名称:redisson-benchmark,代码行数:16,代码来源:BinaryBenchmark.java


注:本文中的org.redisson.api.RedissonClient.getBucket方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。