# \[USE CASE\] ES as cache manager

**URL:** <https://discuss.elastic.co/t/use-case-es-as-cache-manager/95136>\
**Category:** Elasticsearch\
**Created:** [July 31, 2017, 7:58am UTC](https://discuss.elastic.co/t/use-case-es-as-cache-manager/95136 "2017-07-31T07:58:49Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Aleks\_Smith](https://avatars.discourse-cdn.com/v4/letter/a/4bbf92/32.png) [@Aleks\_Smith](https://discuss.elastic.co/u/Aleks_Smith)\
**Post date:** [July 31, 2017, 7:58am UTC](https://discuss.elastic.co/t/use-case-es-as-cache-manager/95136/1 "2017-07-31T07:58:50Z")

</div>

Hello,

Is ES good to be used as a cache manager, in order to access data without going to the database everytime you need it.

I have loads of tables with relations between them, my persistence layer can manage to insert/update/delete in the cache on every operation but my main question is what is the best way to quickly synchronize the cache with the database on 1st startup if there is corruption or whatever that needs to populate the cache again?

Thanks,  
Aleks

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [July 31, 2017, 8:08am UTC](https://discuss.elastic.co/t/use-case-es-as-cache-manager/95136/2 "2017-07-31T08:08:09Z")

</div>

In most of these cases, the persistence layer will handle all of it because it can keep track of the changes that need to be written to Elasticsearch.

Otherwise if you have JDBC you can use something like Logstash to read data in.

---

<div class="post-metadata">

**Author:** ![Aleks\_Smith](https://avatars.discourse-cdn.com/v4/letter/a/4bbf92/32.png) [@Aleks\_Smith](https://discuss.elastic.co/u/Aleks_Smith)\
**Post date:** [July 31, 2017, 8:16am UTC](https://discuss.elastic.co/t/use-case-es-as-cache-manager/95136/3 "2017-07-31T08:16:11Z")

</div>

Hi, thanks for your quick answer, from what I saw the persistence layer just keep track but does not handle the bulk loading at the startup.

In my case it would take ages to do that.

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [July 31, 2017, 8:17am UTC](https://discuss.elastic.co/t/use-case-es-as-cache-manager/95136/4 "2017-07-31T08:17:31Z")

</div>

Why not write any new things to Elasticsearch, and then back fill?  
Then your app can query Elasticsearch first and fail back to the other layer.

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [July 31, 2017, 8:44am UTC](https://discuss.elastic.co/t/use-case-es-as-cache-manager/95136/5 "2017-07-31T08:44:52Z")

</div>

In case it helps, I explained a strategy for this at [http://david.pilato.fr/blog/2015/05/09/advanced-search-for-your-legacy-application/](http://david.pilato.fr/blog/2015/05/09/advanced-search-for-your-legacy-application/)

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [August 28, 2017, 8:45am UTC](https://discuss.elastic.co/t/use-case-es-as-cache-manager/95136/6 "2017-08-28T08:45:10Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
