Redis Object command

Source: Internet
Author: User

"Redis Object command "

1. OBJECT subcommand [arguments [arguments]]

The Object command allows you to view key a given Redis object from within.

It is usually used in debugging (debugging) or understanding in order to save space and to keyThe use of special coding cases. When using Redis as a caching program, you can also use the information in the OBJECT command to determine keyExpulsion strategy (eviction policies).

The OBJECT command has multiple subcommands:

    • OBJECT REFCOUNT <key>Returns the key number of times the value is stored for a given reference. This command is primarily used for debugging.
    • OBJECT ENCODING <key>Returns the key internal representation (representation) used for the value stored by the given lock.
    • OBJECT IDLETIME <key>Returns key the idle time (idle, not read, or written) for a given self-storage, in seconds.

2.KEYS pattern

Finds all that match the given pattern pattern key .

KEYS *Match all in the database keyKEYS h?lloThe hellohalloAnd hxllosuch as KEYS h*lloThe hlloAnd heeeeellosuch as KEYS h[ae]lloThe helloAnd hallo, but does not match hillo

Special symbols \ separated by

KEYS is very fast, but using it in a large database can still cause performance problems, and if you need to find a specific one from a data set key , you'd better use the Redis collection structure (set) instead.

3,Randomkey

Returns a random (not deleted) one from the current database key .

4.TYPE Key

Returns the type of the key stored value.

return value:

none(key does not exist) stringString listList setCollection zset(ordered set) hashHash table

Reference: http://redisdoc.com/

Redis Object command

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.