项目作者: long2ice

项目描述 :
Auto refresh cache of redis with MySQL binlog
高级语言: Python
项目地址: git://github.com/long2ice/fettler.git
创建时间: 2021-03-02T14:46:27Z
项目社区:https://github.com/long2ice/fettler

开源协议:Apache License 2.0

下载


Fettler

image
image
pypi
ci

Introduction

Fettler is a service that help you refresh redis cache automatically. By listening on MySQL binlog, you can refresh
redis cache in a timely manner and devoid of sensation or consciousness.

architecture

Install

Just install from pypi:

  1. > pip install fettler

Usage

Config file

The example can be found in config.yml.

Run services

First you should run the services, which include producer, consumer.

  1. docker-compose up -d --build

Then the services is running.

Run manual

Run producer

The producer listens on MySQL binlog and send data changes to redis message queue.

  1. > fettler produce
  2. 2021-03-17 23:10:23.228 | INFO | fettler.producer:run:36 - Start producer success, listening on binlog from schemas ['test']....
Run consumer

The consumer consume message queue and delete invalid caches by data changes from binlog and refresh policy registered.

  1. > fettler consume
  2. 2021-03-17 23:10:36.953 | INFO | fettler.consumer:run:21 - Start consumer success, waiting for data changes and delete invalid caches...
Run both producer and consumer in one command

If you only need one consumer, you can just run the producer and consumer in one command.

  1. > fettler start
  2. 2021-03-17 23:10:05.226 | INFO | fettler.consumer:run:21 - Start consumer success, waiting for data changes and delete invalid caches...
  3. 2021-03-17 23:10:05.230 | INFO | fettler.producer:run:36 - Start producer success, listening on binlog from schemas ['test']....

Register cache refresh policy

See examples to see how to add cache refresh policy in you application.

License

This project is licensed under the Apache-2.0 License.