I'm building a real-time service so my real-time database need to storage in memcached before fetch to DB (Avoid to read/write mysql db too much). I want to fetch data to mysql DB when some events occur , etc : before data expire or have least-recently-used (LRU) data. What is solution for my problem ? My system used memcached , mysql ,django and python-memcache Thank
我正在构建一个实时服务,所以我的实时数据库需要在获取数据库之前存储在memcached中(避免过多地读/写mysql数据库)。我想在发生某些事件时将数据提取到mysql数据库等:在数据到期之前或具有最近最少使用(LRU)数据。什么是我的问题的解决方案?我的系统使用了memcached,mysql,django和python-memcache谢谢
1 个解决方案
#1
1
Memcached is not a persistent store, so if you need your data to be durable at all then you will need to store them in a persistent store immediately.
Memcached不是持久性存储,因此如果您需要数据持久,那么您需要立即将它们存储在持久性存储中。
So you need to put them somewhere - possibly a MySQL table - as soon as the data arrive, and make sure they are fsync'd to disc. Storing them in memcached as well only speeds up access, so it is a nice to have.
因此,一旦数据到达,您需要将它们放在某处 - 可能是MySQL表 - 并确保它们与光盘同步。将它们存储在memcached中只会加快访问速度,所以很高兴。
Memcached can discard any objects at any time for any reason, not just when they expire.
Memcached可以出于任何原因随时丢弃任何对象,而不仅仅是在它们到期时。
#1
1
Memcached is not a persistent store, so if you need your data to be durable at all then you will need to store them in a persistent store immediately.
Memcached不是持久性存储,因此如果您需要数据持久,那么您需要立即将它们存储在持久性存储中。
So you need to put them somewhere - possibly a MySQL table - as soon as the data arrive, and make sure they are fsync'd to disc. Storing them in memcached as well only speeds up access, so it is a nice to have.
因此,一旦数据到达,您需要将它们放在某处 - 可能是MySQL表 - 并确保它们与光盘同步。将它们存储在memcached中只会加快访问速度,所以很高兴。
Memcached can discard any objects at any time for any reason, not just when they expire.
Memcached可以出于任何原因随时丢弃任何对象,而不仅仅是在它们到期时。