{"id":21672497,"url":"https://github.com/redis-developer/sql-cache-invalidation-debezium","last_synced_at":"2026-03-09T14:06:14.735Z","repository":{"id":104844244,"uuid":"323562981","full_name":"redis-developer/sql-cache-invalidation-debezium","owner":"redis-developer","description":"This project shows how to use Debezium to update Redis from PostgreSQL transactions","archived":false,"fork":false,"pushed_at":"2020-12-22T09:06:00.000Z","size":13,"stargazers_count":6,"open_issues_count":0,"forks_count":2,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-04-12T03:53:08.782Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/redis-developer.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2020-12-22T08:13:35.000Z","updated_at":"2023-10-25T15:25:27.000Z","dependencies_parsed_at":null,"dependency_job_id":"53df424a-7155-42da-8ed1-3ec2d1eccbb6","html_url":"https://github.com/redis-developer/sql-cache-invalidation-debezium","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/redis-developer/sql-cache-invalidation-debezium","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redis-developer%2Fsql-cache-invalidation-debezium","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redis-developer%2Fsql-cache-invalidation-debezium/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redis-developer%2Fsql-cache-invalidation-debezium/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redis-developer%2Fsql-cache-invalidation-debezium/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/redis-developer","download_url":"https://codeload.github.com/redis-developer/sql-cache-invalidation-debezium/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redis-developer%2Fsql-cache-invalidation-debezium/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30297912,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-09T13:46:43.843Z","status":"ssl_error","status_checked_at":"2026-03-09T13:46:42.821Z","response_time":61,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-25T13:29:41.702Z","updated_at":"2026-03-09T14:06:14.727Z","avatar_url":"https://github.com/redis-developer.png","language":"Java","readme":"## Caching Update with Debezium\n\nThis demonstration shows how you can use Debezium to create, update, and delete data cached in Redis.\n\n\n```\n+------------+      +-----------+       +---------+\n|            |      |           |       |         |\n| PostgreSQL | ---\u003e | Debdezium |  ---\u003e |  Redis  |\n|            |      |           |       |         |\n+------------+      +-----------+       +---------+\n```\n\n**Prerequisites**\n\n* Docker\n   * To run Postgresl \u0026 Redis\n* Java Developer Kit (8 or later)\n* Apache Maven\n\n### Running the demonstration\n\n1. Get the source code from the repository\n\n    ```\n    \u003e git clone https://github.com/redis-developer/sql-cache-invalidation-debezium.git\n\n    \u003e cd sql-cache-invalidation-debezium\n    ```\n\n1. Start Redis\n\n    The Java Spring application use Jedis to connect to Redis. The connection string is located in the `application.properties` file.\n\n    Open a new terminal and run the command:\n\n    ```\n    \u003e docker run -it --rm --name redis -p 6379:6379 redis\n    ```\n\n1. Build and Run PostgreSQL database\n\n    In the sql-cache-invalidation-debezium run the following commands:\n\n    ```\n    \u003e cd posgresql\n\n    \u003e docker build -t postgresql-cdc .\n\n    \u003e  docker run -it --rm --name postgresql-cdc -p 5432:5432 -e POSTGRES_PASSWORD=password postgresql-cdc\n\n    ```\n\n    The PostreSQL instance is started with the configuration options needed by the [Debezium Postgres Connector](https://debezium.io/documentation/reference/1.3/connectors/postgresql.html).\n\n\n\n1. Connect to PostgreSQL \u0026 create tables\n    \n    Use the Docker container to connect to PostgreSQL.\n\n    ```\n    \u003e docker exec -it postgresql-cdc bash\n    ```\n\n    Connect to PostgreSQL\n    ```\n    bash-5.0# psql -U postgres\n    ```\n\n    Create table and insert rows\n    \n    ```sql\n    CREATE TABLE customers (\n        customer_id serial PRIMARY KEY,\n        username VARCHAR ( 50 ) UNIQUE NOT NULL,\n        first_name VARCHAR ( 50 )  NOT NULL,\n        last_name VARCHAR ( 50 )  NOT NULL,\n        email VARCHAR ( 255 ) UNIQUE NOT NULL\n    );\n\n\n    CREATE TABLE support_level (\n        level VARCHAR (30)  UNIQUE NOT NULL\n    );\n\n    CREATE TABLE orders (\n        cust_id INT NOT NULL,\n        order_type VARCHAR (10) NOT NULL,\n        order_date DATE DEFAULT CURRENT_DATE,\n        comments TEXT,\n        PRIMARY KEY (cust_id, order_type)\n    );\n\n    ```\n\n    You can check that tables are created using the command:\n\n    ```sql\n    \\dt\n    ```\n\n1. Insert rows into tables\n\n    ```sql \n    INSERT INTO customers\n    (username, first_name, last_name, email)\n    VALUES\n    ('jdoe1', 'John', 'Doe', 'jdoe1@demo.com');\n    ```\n\n\n\n1. Build and run the Java application\n\n    The Java application is a SpringBoot application that exposes a REST endpoint to start and stop the Debezium service. This service captures tthe connector continuously captures row-level changes that insert, update, and delete database content and that were committed to a PostgreSQL database\n\n\n    Open a new terminal in the `sql-cache-invalidation-debezium` directory and run the following commands:\n\n    ```\n    \u003e cd debezium-redis-demo\n\n    \u003e mvn clean spring-boot:run\n\n    ```\n\n1. Start the Debezium server\n\n    Open your browser and go to:\n\n    http://localhost:8082/start\n\n\n\n1. Insert new rows into tables\n\n    ```sql \n    INSERT INTO customers\n    (username, first_name, last_name, email)\n    VALUES\n    ('jdoe2', 'John', 'Doe', 'jdoe2@demo.com');\n    ```\n\n\n    ```sql \n    INSERT INTO orders\n    (cust_id, order_type, comments)\n    VALUES(1, 'ONLINE', 'comment for first order' );\n    ```\n\n    ```sql\n    INSERT INTO support_level\n    (level)\n    VALUES\n    ('GOLD');\n    ```\n    This last row is not synchronized to Redis since the `support_level` table is not in the `table.include.list`. (`application.properties`)\n\n\n\nNote: When you restart the Debezium service, you need to send a transaction to start the replication, so be sure you reset the service using `http://localhost:8082/reset` if you have anty issue. ","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fredis-developer%2Fsql-cache-invalidation-debezium","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fredis-developer%2Fsql-cache-invalidation-debezium","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fredis-developer%2Fsql-cache-invalidation-debezium/lists"}