java operation redis (jedis) exemplary conventional method

 

Description: redis command and jedis basic method name is one to one

 

Redis commonly used commands
1 connection Operation Command
● quit: close the connection (Connection)
● auth: simple password authentication
● help cmd: View cmd help, for example: Help quit
2 persistence
● save: synchronize data saved to disk
● bgsave: data save to disk asynchronously
stamp return to the last successful save data to disk Unix: ● LASTSAVE
● the shutdown: synchronize data saved to disk, and then close the service
3 remote service control
● info: provides server information and statistics
● monitor: real-time dump request received
● slaveof: copy change policy settings
● config: configure Redis server at runtime
command four pairs of key operation
● exists (key): to confirm the existence of a key
● del (key): delete a key
● of the type (key): return value type
● keys (pattern): returns satisfied for all key given pattern of
● randomkey: random return key space a
● keyrename (oldname, newname): rename key
● the dbsize: returns the database key current the number
● expire: activity setting time (s) of a key
when a key event is obtained: ● ttl
● select (index): Press the index query
● move (key, dbindex): Moves the current database key to dbindex database
● flushdb: Delete the current selection of all key database
● flushall: Delete all key all databases
5 String
● set (key, value): a database name given to the value of the value for the key of the string
● GET (key): returns the database name is key the string value
● GetSet (key, value): a name given on to key the string time value
● mget (key1, key2, ..., N Key): returns the string of the plurality of library value
● SETNX (key, value): add string, the name key, value value
● SETEX (key, time, value ): was added to the library string, set the expiration time time
● MSET (Key N, N value): bulk setting values of a plurality of string
● msetnx (key N, value N ): If all the name is not in the string key i presence
● incr (key): name by an operation of key of String
● incrby (key, integer): Title increase integer of key of String
● DECR (key): name decremented to key a String
● decrby (key, integer ): the name of the key to reducing integer string
● append (key, value): name string with the given key value of the additional value
● substr (key, Start, End): Returns the name of the sub-value of the key of the string string
. 6 List
● RPUSH (key, value): the name Add a value for the key value of the last element of the list
● lpush (key, value): adding name is key value is a first list element
● llen (key): the length of the list and returns the name of the key
● lrange (key, start, end): returns the name is key to start the list elements between End
● LTRIM (key, start, end): intercepting name is key list
● the lindex (key, index): returns the name is key the index position in the list of elements
● lset (key, index, value ): to name an element key index position in the list of assignments
● lrem (key, count, value ): delete key to count the median value of list elements
● lpop (key): to go back and delete the name is key list in the first element
● rpop (key): to go back and delete the name is key list of the last element
● blpop (key1, key2, ... key N, timeout) : block version lpop command.
● brpop (key1, key2, ... key N, timeout): block version of rpop.
● rpoplpush (srckey, dstkey): Returns the name and remove the last element of the list of srckey, and adds the element to the list of named dstkey head
7 the Set
● Sadd (key, Member): the name is key set add elements Member
● Srem (key, Member): delete the name is key set of elements Member
● SPOP (key): random back and delete the name is key set in an element
● smove (srckey, dstkey, member ): move collection element
● scard (key): returns the name for the set of key base
● sismember (key, member): member whether the key is the name for the set of elements
● sinter (key1, key2, ... key N): intersection of
● sinterstore (dstkey, (keys) ): and the intersection of the intersection of the saved set dstkey
● sunion (key1, (keys) ): find and set
● sunionstore (dstkey, (keys) ): find and set union and save to dstkey set
● sdiff (key1, (keys) ): differencing set
● sdiffstore (dstkey, (keys) ): differencing sets and save the difference set dstkey set
● smembers (key): returns the name is key the set of all elements
● srandmember (key): random and returns the name of the key set An element
. 8 the Hash
● HSET (key, field, value): for key hash additive element field to name
● hget (key, field): Returns the name of the hash field corresponding to key value
● hmget (key, (Fields)) : returns the name of the hash field I key corresponding to the value
● hmset (key, (Fields)): additive element field to name is key hash and
● hincrby (key, field, integer ): the name is key hash and field of value increase Integer
● hexists (key, field): a name for the existence of the key key of hash for field domain
● hdel (key, field): delete the name is key in the hash key for the field of domain
● hlen (key ): returns the name of the hash key in the number of elements
● hkeys (key): the hash key and returns the name of all the keys
● hvals (key): returns the name is key in the hash of all keys corresponding value
● hgetall (key) : returns the name is key hash of all keys (field) and its corresponding value

Guess you like

Origin www.cnblogs.com/leskang/p/7840603.html