Home >Backend Development >Python Tutorial >Introduction to redis caching system

Introduction to redis caching system

零下一度
零下一度Original
2017-07-18 10:26:521393browse

Introduction to Redis

Redis is based on memory and can also be based on disk-based persistent nosql database, and is developed using c language.

Data storage structure: key-value

Installation environment preparation

Redis is developed in c language and needs to be compiled using the gcc compiler.

1) Install gcc

a) Install from the disk image: (Restarting the Linux server requires remounting the disk image)

b) Use the yum command directly from mine Download the local URL in the .repo file

c) Mount command: mount /dev/cdrom /mnt

d) Install command: yum -y install gcc

2) Install the upload file plug-in

a) Tool upload file: (only the root directory can be uploaded)

b) Alt+P upload file can only upload the root directory by default

c) Install plug-in: (You can upload files to any directory)

Rz (lrzsz)

Installation command: yum –y install lrzsz (install directly in the disk image)

redis cache system

redis is one of the mainstream key-value nosql databases in the industry. Similar to Memcached, it supports relatively more stored value types, including string (string), list (linked list), set (set), zset (sorted set - ordered set) and hash (hash type). These data types all support push/pop, add/remove, intersection, union, difference, and richer operations, and these operations are all atomic. On this basis, redis supports various different ways of sorting. Like memcached, data is cached in memory to ensure efficiency. The difference is that redis will periodically write updated data to disk or write modification operations to additional record files, and on this basis, master-slave (master-slave) synchronization is achieved.

Operation Mode

1 import paramiko,redis2 3 
r=redis.Redis(host='127.0.0.1',port=6379)#连接redis4 
r.set('foo','Bar')5 print(r.get('foo'))6 for item in r.hscan_iter('info_1'):7
print(item,type(item))

The above is the detailed content of Introduction to redis caching system. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn