Sign inSign up

long2ice/fettler

By long2ice

•Updated over 5 years ago

Auto refresh cache of redis with MySQL binlog

Image
0

256

long2ice/fettler repository overview

⁠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:

> 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.

⁠Use docker-compose(recommended)
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.

> fettler produce

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.

> fettler consume

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.

> fettler start

2021-03-17 23:10:05.226 | INFO     | fettler.consumer:run:21 - Start consumer success, waiting for data changes and delete invalid caches...
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.

Tag summary

Content type

Image

Digest

Size

374.9 MB

Last updated

over 5 years ago

docker pull long2ice/fettler