Tabnine Logo
RedissonClient.getScript
Code IndexAdd Tabnine to your IDE (free)

How to use
getScript
method
in
org.redisson.api.RedissonClient

Best Java code snippets using org.redisson.api.RedissonClient.getScript (Showing top 9 results out of 315)

origin: redisson/redisson

@Override
public long nextTimestamp() {
  long time = System.currentTimeMillis() << 12;
  return redisson.getScript(LongCodec.INSTANCE).eval(RScript.Mode.READ_WRITE,
       "local currentTime = redis.call('get', KEYS[1]);"
      + "if currentTime == false then "
        + "redis.call('set', KEYS[1], ARGV[1]); "
        + "return ARGV[1]; "
      + "end;"
      + "local nextValue = math.max(tonumber(ARGV[1]), tonumber(currentTime) + 1); "
      + "redis.call('set', KEYS[1], nextValue); "
      + "return nextValue;",
      RScript.ReturnType.INTEGER, Arrays.<Object>asList("redisson-hibernate-timestamp"), time);
}
origin: redisson/redisson

@Override
public long nextTimestamp() {
  long time = System.currentTimeMillis() << 12;
  return redisson.getScript(LongCodec.INSTANCE).eval(RScript.Mode.READ_WRITE,
       "local currentTime = redis.call('get', KEYS[1]);"
      + "if currentTime == false then "
        + "redis.call('set', KEYS[1], ARGV[1]); "
        + "return ARGV[1]; "
      + "end;"
      + "local nextValue = math.max(tonumber(ARGV[1]), tonumber(currentTime) + 1); "
      + "redis.call('set', KEYS[1], nextValue); "
      + "return nextValue;",
      RScript.ReturnType.INTEGER, Arrays.<Object>asList("redisson-hibernate-timestamp"), time);
}
origin: redisson/redisson

@Override
public long nextTimestamp() {
  long time = System.currentTimeMillis() << 12;
  return redisson.getScript(LongCodec.INSTANCE).eval(RScript.Mode.READ_WRITE,
       "local currentTime = redis.call('get', KEYS[1]);"
      + "if currentTime == false then "
        + "redis.call('set', KEYS[1], ARGV[1]); "
        + "return ARGV[1]; "
      + "end;"
      + "local nextValue = math.max(tonumber(ARGV[1]), tonumber(currentTime) + 1); "
      + "redis.call('set', KEYS[1], nextValue); "
      + "return nextValue;",
      RScript.ReturnType.INTEGER, Arrays.<Object>asList("redisson-hibernate-timestamp"), time);
}
origin: redisson/redisson

@Override
public long nextTimestamp() {
  long time = System.currentTimeMillis() << 12;
  return redisson.getScript(LongCodec.INSTANCE).eval(RScript.Mode.READ_WRITE,
       "local currentTime = redis.call('get', KEYS[1]);"
      + "if currentTime == false then "
        + "redis.call('set', KEYS[1], ARGV[1]); "
        + "return ARGV[1]; "
      + "end;"
      + "local nextValue = math.max(tonumber(ARGV[1]), tonumber(currentTime) + 1); "
      + "redis.call('set', KEYS[1], nextValue); "
      + "return nextValue;",
      RScript.ReturnType.INTEGER, Arrays.<Object>asList("redisson-hibernate-timestamp"), time);
}
origin: debop/hibernate-redis

public long nextTimestamp(final List<Object> keys) {
 return redisson.getScript().eval(RScript.Mode.READ_WRITE,
                  "redis.call('setnx', KEYS[1], ARGV[1]); " +
                  "return redis.call('incr', KEYS[1]);",
                  RScript.ReturnType.INTEGER, keys, System.currentTimeMillis());
}
origin: debop/hibernate-redis

public long nextTimestamp(final List<Object> keys) {
 return redisson.getScript().eval(RScript.Mode.READ_WRITE,
                  "redis.call('setnx', KEYS[1], ARGV[1]); " +
                  "return redis.call('incr', KEYS[1]);",
                  RScript.ReturnType.INTEGER, keys, System.currentTimeMillis());
}
origin: com.github.debop/hibernate-redis

public long nextTimestamp(final List<Object> keys) {
 return redisson.getScript().eval(RScript.Mode.READ_WRITE,
     "redis.call('setnx', KEYS[1], ARGV[1]); " +
     "return redis.call('incr', KEYS[1]);",
     RScript.ReturnType.INTEGER, keys, System.currentTimeMillis());
}
origin: huangjian888/jeeweb-mybatis-springboot

@Override
public boolean unlock(String key, String requestId) {
  String script = "if redis.call('get', KEYS[1]) == ARGV[1] then return redis.call('del', KEYS[1]) else return 0 end";
  return redissonClient.getScript().eval(Mode.READ_WRITE, script, ReturnType.BOOLEAN,
    ArrayUtils.newArrayList(key), requestId);
}
origin: justlive1/earth-frost

/**
 * 获取当前时间
 *
 * @return time
 */
protected long time() {
 return BeanStore.getBean(RedissonClient.class).getScript().eval(Mode.READ_ONLY,
   "return redis.call('TIME')[1]*1000", ReturnType.INTEGER);
}
org.redisson.apiRedissonClientgetScript

Javadoc

Returns script operations object

Popular methods of RedissonClient

  • shutdown
    Shuts down Redisson instance but NOT Redis server Shutdown ensures that no tasks are submitted for '
  • getMap
    Returns map instance by name using provided codec for both map keys and values.
  • getLock
    Returns lock instance by name. Implements a non-fair locking so doesn't guarantees an acquire order
  • getTopic
    Returns topic instance by name using provided codec for messages.
  • getBucket
    Returns object holder instance by name using provided codec for object.
  • getConfig
    Allows to get configuration provided during Redisson instance creation. Further changes on this obje
  • getMapCache
    Returns map-based cache instance by name using provided codec for both cache keys and values. Suppor
  • getAtomicLong
    Returns atomicLong instance by name.
  • getKeys
    Returns interface with methods for Redis keys. Each of Redis/Redisson object associated with own key
  • getSemaphore
    Returns semaphore instance by name
  • getSet
    Returns set instance by name using provided codec for set objects.
  • getBlockingQueue
    Returns unbounded blocking queue instance by name using provided codec for queue objects.
  • getSet,
  • getBlockingQueue,
  • getList,
  • getScoredSortedSet,
  • getExecutorService,
  • getFairLock,
  • getQueue,
  • getReadWriteLock,
  • getListMultimap

Popular in Java

  • Making http requests using okhttp
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • requestLocationUpdates (LocationManager)
  • getSharedPreferences (Context)
  • IOException (java.io)
    Signals a general, I/O-related error. Error details may be specified when calling the constructor, a
  • Random (java.util)
    This class provides methods that return pseudo-random values.It is dangerous to seed Random with the
  • Collectors (java.util.stream)
  • HttpServlet (javax.servlet.http)
    Provides an abstract class to be subclassed to create an HTTP servlet suitable for a Web site. A sub
  • FileUtils (org.apache.commons.io)
    General file manipulation utilities. Facilities are provided in the following areas: * writing to a
  • Location (org.springframework.beans.factory.parsing)
    Class that models an arbitrary location in a Resource.Typically used to track the location of proble
  • Top Sublime Text plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now