Cache consistency when using memcached and a rdbms like MySQL

前端 未结 4 2070
鱼传尺愫
鱼传尺愫 2021-02-14 03:30

I have taken a database class this semester and we are studying about maintaining cache consistency between the RDBMS and a cache server such as memcached. The consistency issue

4条回答
  •  傲寒
    傲寒 (楼主)
    2021-02-14 04:08

    When you read, the following happens:

    if(Key is not in cache){
      fetch data from db
      put(key,value);
    }else{
      return get(key)
    }
    

    When you write, the following happens:

    1 delete/update data from db
    2 clear cache
    

提交回复
热议问题