import { scalar } from "./base.scalar"; import { cacheDataTypeEnum } from "./cacheDataTypeEnum"; export declare namespace cacheComponent { type CacheTextValueMap = scalar.StrMap; interface CacheInstance { /** * Connect to server * * @returns {Promise} * */ connectAsync(): Promise; readonly connected: boolean; readonly prefix: string; readonly host: string; readonly port: number; deleteRelationsAsync(...ids: Array): Promise; addRelationsAsync(member: scalar.Alpha, ...ids: Array): Promise; /** * Copies the value stored at the source key to the destination key * * >> Returns true if copied * */ copyAsync(key: scalar.Alpha, destination: scalar.Alpha): Promise; /** * Removes the specified keys * * >> The number of keys that were removed * */ delAsync(...keys: Array): Promise; /** * Checks given keys exists or not * * >> the number of keys that exist * */ existsAsync(...keys: Array): Promise; /** * Sets a timeout on key in seconds * * @param {string} key * @param {number} ttl * @returns {Promise} * * >> true if success * */ expireAsync(key: scalar.Alpha, ttl: scalar.Integer): Promise; /** * Sets a timeout on key with unix timestamp in seconds * * >> true if success * */ expireatAsync(key: scalar.Alpha, timestamp: scalar.Integer): Promise; /** * Fetches keys with pattern * * >> list of keys * */ keysAsync(pattern: scalar.Alpha): Promise>; /** * Sets a timeout in milliseconds * * >> true if success * */ pexpireAsync(key: scalar.Alpha, ttl: scalar.Integer): Promise; /** * Sets a timeout on key with unix timestamp in milliseconds * * >> true if success * */ pexpireatAsync(key: scalar.Alpha, timestamp: scalar.Integer): Promise; /** * Makes the key as persistent and removes timeout on key * * >> Returns true if the timeout was removed * */ persistAsync(key: scalar.Alpha): Promise; /** * Fetches the remaining time to live of a key that has a timeout in milliseconds * * >> >= 0: seconds * >> -3: exception * >> -2: key does not exist * >> -1: key exists but has no associated expire * */ pttlAsync(key: scalar.Alpha): Promise; /** * Returns a random key from the currently selected database * * */ randomkeyAsync(): Promise; /** * Renames key to newKey * * >> true: if key was renamed * */ renameAsync(key: scalar.Alpha, newKey: scalar.Alpha): Promise; /** * Alters the last access time of a key(s). A key is ignored if it does not exist. * * >> The number of keys that were touched * */ touchAsync(...keys: Array): Promise; /** * Fetches the remaining time to live of a key that has a timeout * * >> >= 0: seconds, -2: key does not exist, -1: key exists but has no associated expire * */ ttlAsync(key: scalar.Alpha): Promise; /** * Returns the string representation of the type of the value stored at key * * >> Returns any of [string, list, set, zset, hash, stream] * */ typeAsync(key: scalar.Alpha): Promise; /** * is string the type of the value stored at key? * * */ isStringAsync(key: scalar.Alpha): Promise; /** * is list the type of the value stored at key? * * */ isListAsync(key: scalar.Alpha): Promise; /** * is set the type of the value stored at key? * * */ isSetAsync(key: scalar.Alpha): Promise; /** * is zset the type of the value stored at key? * * */ isZsetAsync(key: scalar.Alpha): Promise; /** * is hash the type of the value stored at key? * * */ isHashAsync(key: scalar.Alpha): Promise; /** * is stream the type of the value stored at key? * * */ isStreamAsync(key: scalar.Alpha): Promise; /** * Removes the specified keys asynchronously * * >> The number of keys that were removed * */ unlinkAsync(...keys: Array): Promise; /** * Appends the value to end of the key * !! If key already exists and is a string, this cmd appends the value at the end of the string. If key does not exist it is created and set as an empty string * * >> the length of the string after the append operation * */ appendAsync(key: scalar.Alpha, str: scalar.String): Promise; /** * Count the number of set bits (population counting) in a string * !! Non-existent keys are treated as empty strings, so the cmd will return zero * * >> The number of bits set to 1 * */ bitcountAsync(key: scalar.Alpha, start?: scalar.Integer, end?: scalar.Integer): Promise; /** * */ bitfieldAsync(...args: Array): Promise; /** * */ bitopAsync(...args: Array): Promise; /** * */ bitposAsync(...args: Array): Promise; /** * Decrements the number stored at key by one * !!If the key does not exist, it is set to 0 before performing the operation * * >> the value of key after the decrement * */ decrAsync(key: scalar.Alpha): Promise; /** * Decrements the number stored at key by decrement * !! If the key does not exist, it is set to 0 before performing the operation * * >> the value of key after the decrement * */ decrbyAsync(key: scalar.Alpha, increment: scalar.Integer): Promise; /** * Fetches the value of key * * >> value of key * */ getAsync(key: scalar.Alpha): Promise; /** * Fetches the value of key * * >> value of key * */ getAsJsonAsync(key: scalar.Alpha): Promise; /** * Returns the bit value at offset in the string value stored at key * !! When key does not exist it is assumed to be an empty string * !! When offset is beyond the string length, the string is assumed to be a contiguous space with 0 bits * * >> the bit value stored at offset * */ getbitAsync(key: scalar.Alpha, offset: scalar.Integer): Promise; /** * Returns the substring of the string value stored at key, determined by the offsets start and end (both are inclusive) * !! When key does not exist it is assumed to be an empty string * !! When offset is beyond the string length, the string is assumed to be a contiguous space with 0 bits * * >> the bit value stored at offset * */ getrangeAsync(key: scalar.Alpha, start: scalar.Integer, end: scalar.Integer): Promise; /** * Atomically sets key to value and returns the old value stored at key * * >> the old value stored at key, or nil when key did not exist * */ getsetAsync(key: scalar.Alpha, value: scalar.String): Promise; /** * Atomically sets key to value and returns the old value stored at key * * >> the old value stored at key, or nil when key did not exist * */ getsetAsJsonAsync(key: scalar.Alpha, value: scalar.Unknown): Promise; /** * Increments the number stored at key by one * !!If the key does not exist, it is set to 0 before performing the operation * * >> the value of key after the increment * */ incrAsync(key: scalar.Alpha): Promise; /** * Increments the number stored at key by decrement * !! If the key does not exist, it is set to 0 before performing the operation * * >> the value of key after the increment * */ incrbyAsync(key: scalar.Alpha, increment: scalar.Integer): Promise; /** * Increments the number stored at key by decrement * !! If the key does not exist, it is set to 0 before performing the operation * * >> the value of key after the increment * */ incrbyfloatAsync(key: scalar.Alpha, increment: scalar.Float): Promise; /** * Returns the values of all specified keys * !! If the key does not exist, it is set to 0 before performing the operation * * >> list of values at the specified keys * */ mgetAsync(...keys: Array): Promise>; /** * Returns the values of all specified keys * !! If the key does not exist, it is set to 0 before performing the operation * * >> list of values at the specified keys * */ mgetAsArrayAsync(...keys: Array): Promise; /** * Returns the values of all specified keys * !! If the key does not exist, it is set to 0 before performing the operation * * >> list of values at the specified keys * */ mgetAsMapAsync(...keys: Array): Promise; /** * Sets the given keys to their respective values * !! replaces existing values with new values * * >> true: if keys were set * */ msetAsync(pairs: CacheTextValueMap): Promise; /** * Sets the given keys to their respective values * !! replaces existing values with new values * * >> true: if keys were set * */ msetAsJsonAsync(pairs: scalar.AnyObject): Promise; /** * Sets the given keys to their respective values * !! will not perform any operation at all even if just a single key already exists * * >> true: if the all the keys were set, false if no key was set (at least one key already existed) * */ msetnxAsync(pairs: CacheTextValueMap): Promise; /** * Sets the given keys to their respective values * !! will not perform any operation at all even if just a single key already exists * * >> true: if the all the keys were set, false if no key was set (at least one key already existed) * */ msetnxAsJsonAsync(pairs: scalar.AnyObject): Promise; /** * Sets value of key with ttl in milliseconds * * >> true if key was set * */ psetexAsync(key: scalar.Alpha, value: scalar.String, ttl: scalar.Integer): Promise; /** * Sets value of key with ttl in milliseconds * * >> true if key was set * */ psetexAsJsonAsync(key: scalar.Alpha, value: scalar.Unknown, ttl: scalar.Integer): Promise; /** * Sets value of key * * >> true if key was set * */ setAsync(key: scalar.Alpha, value: scalar.String): Promise; /** * Sets value of key * * >> true if key was set * */ setAsJsonAsync(key: scalar.Alpha, value: scalar.Unknown): Promise; /** * Sets value of key with ttl in seconds * * >> true if key was set * */ setexAsync(key: scalar.Alpha, value: scalar.String, ttl: scalar.Integer): Promise; /** * Sets value of key with ttl in seconds * * >> true if key was set * */ setexAsJsonAsync(key: scalar.Alpha, value: scalar.Unknown, ttl: scalar.Integer): Promise; /** * Sets or clears the bit at offset in the string value stored at key * !! When key does not exist, a new string value is created * !! When offset is beyond the string length, the string is assumed to be a contiguous space with 0 bits * * >> the original bit value stored at offset. * */ setbitAsync(key: scalar.Alpha, offset: scalar.Integer, value: scalar.Integer): Promise; /** * Set key to hold string value if key does not exist * !! When key already holds a value, no operation is performed * * >> true: if the key was set, false: if the key was not set * */ setnxAsync(key: scalar.Alpha, value: scalar.String): Promise; /** * Set key to hold string value if key does not exist * !! When key already holds a value, no operation is performed * * >> true: if the key was set, false: if the key was not set * */ setnxAsJsonAsync(key: scalar.Alpha, value: scalar.Unknown): Promise; /** * Overwrites part of the string stored at key, starting at the specified offset, for the entire length of value * !! If the offset is larger than the current length of the string at key, the string is padded with zero-bytes to make offset fit * !! Non-existing keys are considered as empty strings, so this cmd will make sure it holds a string large enough to be able to set value at offset * * >> the length of the string after it was modified by the cmd * */ setrangeAsync(key: scalar.Alpha, offset: scalar.Integer, value: scalar.String): Promise; /** * */ stralgoAsync(...args: Array): Promise; /** * Returns the length of the string value stored at key * !! An error is returned when key holds a non-string value * * >> the length of the string at key, or 0 when key does not exist * */ strlenAsync(key: scalar.Alpha): Promise; /** * Removes the specified fields from the hash stored at key * * >> the number of fields that were removed from the hash * */ hdelAsync(key: scalar.Alpha, ...fields: Array): Promise; /** * Returns if field is an existing field in the hash stored at key * * >> true: field exists, false: field is absent * */ hexistsAsync(key: scalar.Alpha, field: scalar.Alpha): Promise; /** * Returns the value associated with field in the hash stored at key * * >> the value associated with field, or nil when field is not present in the hash or key does not exist * */ hgetAsync(key: scalar.Alpha, field: scalar.Alpha): Promise; /** * Returns the value associated with field in the hash stored at key * * >> the value associated with field, or nil when field is not present in the hash or key does not exist * */ hgetAsJsonAsync(key: scalar.Alpha, field: scalar.Alpha): Promise; /** * Returns all fields and values of the hash stored at key * * >> key/value pairs * */ hgetallAsync(key: scalar.Alpha): Promise; /** * Returns all fields and values of the hash stored at key * * >> key/value pairs * */ hgetallAsJsonAsync(key: scalar.Alpha): Promise; /** * Increments the number stored at field in the hash stored at key by increment * !! If key does not exist, a new key holding a hash is created * !! If field does not exist the value is set to 0 before the operation is performed. * * >> the value at field after the increment operation * */ hincrbyAsync(key: scalar.Alpha, field: scalar.Alpha, increment: scalar.Integer): Promise; /** * Increments the number stored at field in the hash stored at key by increment * !! If key does not exist, a new key holding a hash is created * !! If field does not exist the value is set to 0 before the operation is performed. * * >> the value at field after the increment operation * */ hincrbyfloatAsync(key: scalar.Alpha, field: scalar.Alpha, increment: scalar.Float): Promise; /** * Returns all field names in the hash stored at key * * >> list of fields in the hash, or an empty list when key does not exist. * */ hkeysAsync(key: scalar.Alpha): Promise>; /** * Returns the number of fields contained in the hash stored at key * * >> number of fields in the hash, or 0 when key does not exist * */ hlenAsync(key: scalar.Alpha): Promise; /** * Returns the values associated with the specified fields in the hash stored at key * !! For every field that does not exist in the hash, a nil value is returned * * >> list of values associated with the given fields, in the same order as they are requested * */ hmgetAsync(key: scalar.Alpha, ...fields: Array): Promise; /** * Returns the values associated with the specified fields in the hash stored at key * !! For every field that does not exist in the hash, a nil value is returned * * >> list of values associated with the given fields, in the same order as they are requested * */ hmgetAsJsonAsync(key: scalar.Alpha, ...fields: Array): Promise; /** * Sets the specified fields to their respective values in the hash stored at key * !! This cmd overwrites any specified fields already existing in the hash * !! If key does not exist, a new key holding a hash is created. * * >> true if key was set * */ hmsetAsync(key: scalar.Alpha, value: CacheTextValueMap): Promise; /** * Sets the specified fields to their respective values in the hash stored at key * !! This cmd overwrites any specified fields already existing in the hash * !! If key does not exist, a new key holding a hash is created. * * >> true if key was set * */ hmsetAsJsonAsync(key: scalar.Alpha, pairs: scalar.AnyObject): Promise; /** * */ hscanAsync(...args: Array): Promise; /** * Sets the specified fields to their respective values in the hash stored at key * !! This cmd overwrites any specified fields already existing in the hash * !! If key does not exist, a new key holding a hash is created. * * >> The number of fields that were added * */ hsetAsync(key: scalar.Alpha, pairs: CacheTextValueMap): Promise; /** * Sets the specified fields to their respective values in the hash stored at key * !! This cmd overwrites any specified fields already existing in the hash * !! If key does not exist, a new key holding a hash is created. * * >> The number of fields that were added * */ hsetAsJsonAsync(key: scalar.Alpha, pairs: scalar.AnyObject): Promise; /** * Sets field in the hash stored at key to value, only if field does not yet exist * !! If key does not exist, a new key holding a hash is created. * !! If field already exists, this operation has no effect * * >> true: if field is a new field in the hash and value was set * >> false: if field already exists in the hash and no operation was performed * */ hsetnxAsync(key: scalar.Alpha, field: scalar.Alpha, value: scalar.String): Promise; /** * Sets field in the hash stored at key to value, only if field does not yet exist * !! If key does not exist, a new key holding a hash is created. * !! If field already exists, this operation has no effect * * >> true: if field is a new field in the hash and value was set * >> false: if field already exists in the hash and no operation was performed * */ hsetnxAsJsonAsync(key: scalar.Alpha, field: scalar.Alpha, value: scalar.Unknown): Promise; /** * Returns the string length of the value associated with field in the hash stored at key * !! If the key or the field do not exist, 0 is returned * * >> the string length of the value associated with field, or zero when field is not present in the hash or key does not exist at all. * */ hstrlenAsync(key: scalar.Alpha, field: scalar.Alpha): Promise; /** * Returns all values in the hash stored at key * * >> list of values in the hash, or an empty list when key does not exist. * */ hvalsAsync(key: scalar.Alpha): Promise>; /** * Returns all values in the hash stored at key * * >> list of values in the hash, or an empty list when key does not exist. * */ hvalsAsJsonAsync(key: scalar.Alpha): Promise>; /** * Adds the specified members to the set stored at key * * >> the number of elements that were added to the set * */ saddAsync(key: scalar.Alpha, ...members: Array): Promise; /** * Fetches the set cardinality (number of elements) of the set stored at key * * >> number of elements * */ scardAsync(key: scalar.Alpha): Promise; /** * Fetches the members of the set resulting from the difference between the first set and all the successive sets * * >> members * */ sdiffAsync(...keys: Array): Promise>; /** * This cmd is equal to SDIFF, but instead of returning the resulting set, it is stored in destination. * If destination already exists, it is overwritten. * * >> the number of elements in the resulting set * */ sdiffstoreAsync(destination: scalar.Alpha, ...keys: Array): Promise; /** * Returns the members of the set resulting from the intersection of all the given sets. * * >> list with members of the resulting set * */ sinterAsync(...keys: Array): Promise>; /** * This cmd is equal to SINTER, but instead of returning the resulting set, it is stored in destination. * If destination already exists, it is overwritten. * * >> the number of elements in the resulting set * */ sinterstoreAsync(destination: scalar.Alpha, ...keys: Array): Promise; /** * Returns if member is a member of the set stored at key * * >> true if member exists * */ sismemberAsync(key: scalar.Alpha, member: scalar.String): Promise; /** * Lists members of a set * * >> all elements of the set * */ smembersAsync(key: scalar.Alpha): Promise>; /** * Move member from the set at source to the set at destination * * >> true if member is moved * */ smoveAsync(key: scalar.Alpha, destination: scalar.Alpha, member: scalar.String): Promise; /** * Removes and returns one or more random elements from the set value store at key. * * >> members * */ spopAsync(key: scalar.Alpha, count?: scalar.Integer): Promise>; /** * When called with just the key argument, return a random element from the set value stored at key. * * >> members * */ srandmemberAsync(key: scalar.Alpha, count?: scalar.Integer): Promise>; /** * Removes the a member from a key * * >> the number of members that were removed from the set * */ sremAsync(key: scalar.Alpha, ...members: Array): Promise; /** * Returns the members of the set resulting from the union of all the given sets. * * >> list with members of the resulting set * */ sunionAsync(...keys: Array): Promise>; /** * This cmd is equal to SUNION, but instead of returning the resulting set, it is stored in destination. * If destination already exists, it is overwritten. * * >> the number of elements in the resulting set * */ sunionstoreAsync(destination: scalar.Alpha, ...keys: Array): Promise; } }