Redis is a good cache database, and reading data is very efficient. Today we work together on the use of Redis. The combination of online information and their own groping, first look at the installation and configuration.We mainly look at how to
Want to install Redis to this directory
1
/usr/local/redis
You want to download the installation package to this directory
1
/usr/local/src
Then the installation process instructions
The editor can't even paste the picture directly, but I like it. Had to make the post directly into the picture.Use the Linux command as follows, for lazy classmates to copy and paste directly1. Download the Redis installation package wget
1.redis Introduction: Redis is an open source, Advanced key-value storage System. It is commonly referred to as a data structure server, because the value can be a string (string), a hash (hashes), a list, a collection (sets), and an ordered
Environment Building under redis WindowsRedisis aKey-valueStorage System. and theMemcachedSimilarly, it supports the storage ofvaluetypes are relatively more, includingString (string),List (Linked list),Set (Collection),Zset (sorted set--ordered
1, download the Redis Windows application, support 32-bit and 64-bit, according to the actual situation download: Https://github.com/dmajkic/redis/downloads2, copy the corresponding program to the directory you need, where I use the 64-bit, put in
Redis accepts connections on the configured listener TCP port and UNIX socket client, if enabled. When a new client connection is accepted, the following actions are performed:
Client sockets are placed in a non-blocking state because Redis
Hash is a mapping table of some column key value (field value). It is often used to store some object instances. Storing as a hash consumes less memory than storing the individual fields of an object as a string. Why do you save more memory? Need to
"Redis key space Notification "Key-space notifications allow clients to subscribe to channels or patterns to receive events that change the Redis dataset in some way.Here are some examples of events sent by a key-space notification:
All the
We can use the data for the system storage in two different angles, one is divided by the size of the data, divided into big data and small data, the other is divided into cold and hot data according to the data, the thermal data refers to read or
BgrewriteaofAsynchronously rewrite the append-only fileBGSAVEAsynchronously save the dataset to diskCLIENT KILL [Ip:port] [ID Client-id] [TYPE normal|slave|pubsub] [ADDR ip:port] [SKIPME yes/no]Kill the connection of a clientCLIENT LISTGet the list
# By default, Redis does not run as a daemon. Use ' yes ' if you need it.# Note that Redis would write a PID file in/var/run/redis.pid when daemonized. #Redis默认不是以守护进程的方式运 Line, which can be modified by this configuration item, using Yes to enable
Normal way
Look directly at the code
package com.whereta.jedis;import org.springframework.stereotype.component;import redis.clients.jedis.jedis;import redis.clients.jedis.jedispool;import javax.annotation.resource;
Redis Installation:Windows installation package: Http://pan.baidu.com/s/1i3jLlC5After downloading, start the installation:Redis-server.exe redis.conf:A simple step, the installation succeeds, keep this Windows running continuously ~Look at our local
1. RedisHow to handle outdated events1.1. RedisProcessing ExpiredKeyWayRedis KeyThere are two ways to expire: passive mode and active way whenClientsAn attempt was made to access a setting that has an expiration time and has expiredKeyis the
Redis uses SDS instead of char * strings,It is defined as follows:Char *SDS; struct SDSHDR { int len; int Free ; Char buf[];};SDS points to a char stringSDSHDR is the string headerMore ingenious structureUse char buf[] to store the
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