Postgresql+redis Cache

Source: Internet
Author: User
Tags postgresql
The story of PostgreSQL and its friends-Redis

Read and write Redis directly in PostgreSQL.
Many benefits, can reduce the complexity of application layer design, reduce the number of interactions, reduce Rt.
Examples of application scenarios:
.1. Improve database performance by using Redis as a level two cache for PostgreSQL.
For example, in production there are multiple Redis hosts or clusters, using Redis to extend the two-level cache capability of PG, reducing the need for IO.
This can be done in the form of a trigger, when data is inserted or updated, and inserted or updated to Redis.
Removed from Redis when deleted.
When used as a level two cache, the update operates Redis directly from PostgreSQL to reduce the total number of interactions.
Querying Redis directly or querying Redis from PostgreSQL is OK, and if it's optimistic, it's okay to check from Redis, and if it's pessimistic, read from PostgreSQL and write to Redis.
.2. For example, to calculate the count number of records, when data is inserted or deleted, the record is either self-increment or decrement.
.3. Use to label data, such as data storage, according to the user ID of the data and the behavior of the recorded habits of labeling, the label information directly into Redis, as a real-time tagging system.

Postgresql+redis Cache

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.