'Sync AWS Elasticache(Redis) to MySQL Database Table

I am using AWS Elasicache(Redis) using PHP & MySQL for different caching purposes that are mentioned below

  • Reducing the load on MySQL
  • Session Handling
  • Database query results in caching
  • Caching some most frequently used data
  • exploring the benefits of Redis in different areas

I am looking for a solution to sync Redis Session data(Keys & Values) to a MySQL Table for backup on AWS RDS whenever Redis clears data or any event(Session delete, update,..) triggers.

I have some rough thoughts to achieve this using AWS Elasicache & Lambda function to sync Redis data to MySQL table.

Is there any efficient approach/solution to achieve this purpose?

Thanks for your time and solution.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source