Today,Mayuyu to learn how to operate a Redis database in C + +. Implemented through the Hiredis.h interface , currently available only in Linux environments.The hiredis.h is:Https://github.com/redis/hiredisThe following four methods are mainly
Redis-relatedThe difference between 1.Memcache and RedisStorage modeMemecache all of the data in memory, after the power outage will be suspended, the data can not exceed the memory size.Redis is partially present on the hard drive, which guarantees
First, BackgroundThe company's Redis sometimes background save db is unsuccessful, and the following alarm is found through log, which is likely to be caused by it:[13223] ~ Mar 13:18:02.207 # WARNING Overcommit_memory is set to 0! Background save
Redis shell command Daquan (go fromhttp://blog.mkfree.com/posts/5105432f975ad0eb7d135964)
OYHK 2013-1-28 3:11:35 0 Reviews 783 views
APPEND key value appends a value to the keyAUTH Password Authentication Serverbgrewriteaof
Waiter, serving!!!1. Installing the Redis service on a virtual machineDownload the tar package, wget http://download.redis.io/releases/redis-2.8.19.tar.gz.Decompression, TAR-ZXVF redis-2.8.19.tar.gzGo to Folder, CD redis-2.8.19/, compile, makeCreate
The idea of using Redis as a cache is to configure the interceptor in the spring project, make slices on the service layer, and intercept on methods such as FINDXXX or getxxx to determine if caching is possible.1. Environment: Spring 3.1.2 + Spring
InstallationGo to http://redis.io/Download the latest stable version of the source code. Unzip, go to unzip directory, executemakemake installAfter src/ that, there are several more files in the
According to a number of tests organized a plan:1. Redis Performance
Some simple tests for Redis are for informational purposes only:
Test environment: Redhat6.2, Xeon E5520 (4-core) *2/8g,1000m NIC
Redis version: 2.6.9
The client
Analysis of Redis transaction and improvement of the transaction characteristics of RedisHow many of the data acid properties are met?To keep it simple, Redis transactions guarantee consistency and isolation;Not satisfying atomicity and
Within Redis, data structure type values are supported by efficient data structures and algorithms, and are used extensively in the construction of Redis itself.This section describes the data structures and algorithms used by Redis memory.Dynamic
Transactional Redis in Redis supports simple transaction Redis vs. mysql transactions-------------------------------------------------------MySQL Redis-------------------------------------------------------Open start transaction muitl----------------
Redis Cluster is still in Beta andRedis 3.0 will be added, where you can preview the main features and principles first. Refer to "Redis cluster-a pragmatic approach to distribution".1without a clusterRedisRediswith no clustering capabilities, each
Start Redis ServiceSrc/redis-server or Src/redis-server redis.confSrc/redis-server redis.conf 1>log.log 2>errlog.log1 is the standard output and 2 is the error outputRandomly start Redis as a Linux serviceVi/etc/rc.local, add
The common commands of Redis are divided into two main parts, one is the key-value related command, the other is the server-related command1. Key-Value related commandsKeys * Take out all current keyexists name to see if n has name this keyDel name
Redis Cluster Deployment1. Installation of Redis 3.0.1, see Redis 3.0.1 Installation and configuration2. Create a DirectoryMkdir-p/usr/local/redis/70003. Copying filescd/tmp# Copy the default configuration document CP
1. Advantage: Loose couplingeasy to scale, consumers can expand multiple, distributed across different servers2, Lpush rpop3, Brpop command and Rpop similar, the only difference: when there are no elements in the list, the Brpop command will always
1. Boot automatically start Redis1), copy the Redis_init_script file under Redis directory utils to/ETC/INIT.D and rename it to REDISD, then run chmod u+x REDISD2), modify the redis.conf under the Redis root directory, change the daemonize to Yes,
Redis is a key, a value database, and a memory database. The architecture of an internet company is now standard.
The supported data objects are string, list, set, zest, and hash object.
Data:
The core structure of the database is dict
I. commands related to the key expiration Function
Ii. Set the survival time
Redis provides two commands to set the TTL (time to live) of keys, which are:
If the given key does not exist, both expire and pexpire return 0, indicating that the
The English version of this article was first published in codeproject: Building a simple URL shorten service with redis
Before reading this article, I suggest you download the source code, read the article, and read the code.
Download the code here:
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