All Downloads are FREE. Search and download functionalities are using the official Maven repository.

main.misk.redis.DeferredRedis.kt Maven / Gradle / Ivy

There is a newer version: 2024.09.17.200749-4708422
Show newest version
package misk.redis

import misk.redis.Redis.ScanResult
import okio.ByteString
import redis.clients.jedis.args.ListDirection
import java.time.Duration
import java.util.function.Supplier

/**
 * Like [Redis], but returns [Supplier]s to defer value retrieval.
 * **Does not support transactions or pubsub.**
 */
interface DeferredRedis {
  fun del(key: String): Supplier

  fun del(vararg keys: String): Supplier

  fun mget(vararg keys: String): Supplier>

  fun mset(vararg keyValues: ByteString): Supplier

  operator fun get(key: String): Supplier

  fun getDel(key: String): Supplier

  fun hdel(key: String, vararg fields: String): Supplier

  fun hget(key: String, field: String): Supplier

  fun hgetAll(key: String): Supplier?>

  fun hlen(key: String): Supplier

  fun hmget(key: String, vararg fields: String): Supplier>

  fun hincrBy(key: String, field: String, increment: Long): Supplier

  fun hrandFieldWithValues(key: String, count: Long): Supplier?>

  fun hrandField(key: String, count: Long): Supplier>

  fun set(key: String, value: ByteString, expiryDuration: Duration? = null): Supplier

  fun setnx(key: String, value: ByteString, expiryDuration: Duration? = null): Supplier

  fun hset(key: String, field: String, value: ByteString): Supplier

  fun hset(key: String, hash: Map): Supplier

  fun incr(key: String): Supplier

  fun incrBy(key: String, increment: Long): Supplier

  fun blmove(
    sourceKey: String,
    destinationKey: String,
    from: ListDirection,
    to: ListDirection,
    timeoutSeconds: Double
  ): Supplier

  fun brpoplpush(
    sourceKey: String,
    destinationKey: String,
    timeoutSeconds: Int
  ): Supplier

  fun lmove(
    sourceKey: String,
    destinationKey: String,
    from: ListDirection,
    to: ListDirection
  ): Supplier

  fun lpush(key: String, vararg elements: ByteString): Supplier

  fun rpush(key: String, vararg elements: ByteString): Supplier

  fun lpop(key: String, count: Int): Supplier>

  fun lpop(key: String): Supplier

  fun rpop(key: String, count: Int): Supplier>

  fun rpop(key: String): Supplier

  fun lrange(key: String, start: Long, stop: Long): Supplier>

  fun lrem(key: String, count: Long, element: ByteString): Supplier

  fun rpoplpush(sourceKey: String, destinationKey: String): Supplier

  fun expire(key: String, seconds: Long): Supplier

  fun expireAt(key: String, timestampSeconds: Long): Supplier

  fun pExpire(key: String, milliseconds: Long): Supplier

  fun pExpireAt(key: String, timestampMilliseconds: Long): Supplier

  fun zadd(
    key: String,
    score: Double,
    member: String,
    vararg options: Redis.ZAddOptions
  ): Supplier

  fun zadd(
    key: String,
    scoreMembers: Map,
    vararg options: Redis.ZAddOptions
  ): Supplier

  fun zscore(
    key: String,
    member: String
  ): Supplier

  fun zrange(
    key: String,
    type: Redis.ZRangeType = Redis.ZRangeType.INDEX,
    start: Redis.ZRangeMarker,
    stop: Redis.ZRangeMarker,
    reverse: Boolean = false,
    limit: Redis.ZRangeLimit? = null,
  ): Supplier>

  fun zrangeWithScores(
    key: String,
    type: Redis.ZRangeType = Redis.ZRangeType.INDEX,
    start: Redis.ZRangeMarker,
    stop: Redis.ZRangeMarker,
    reverse: Boolean = false,
    limit: Redis.ZRangeLimit? = null,
  ): Supplier>>

  fun zremRangeByRank(
    key: String,
    start: Redis.ZRangeRankMarker,
    stop: Redis.ZRangeRankMarker,
  ): Supplier

  fun zcard(key: String): Supplier

  fun close()
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy