# May I ask in Ristretto how can I sync with Database?

**URL:** <https://discuss.dgraph.io/t/may-i-ask-in-ristretto-how-can-i-sync-with-database/5795>\
**Category:** Misc\
**Created:** [January 10, 2020, 8:26am UTC](https://discuss.dgraph.io/t/may-i-ask-in-ristretto-how-can-i-sync-with-database/5795 "2020-01-10T08:26:41Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![fr-zec](https://avatars.discourse-cdn.com/v4/letter/f/73ab20/32.png) [@fr-zec](https://discuss.dgraph.io/u/fr-zec)\
**Post date:** [January 10, 2020, 8:26am UTC](https://discuss.dgraph.io/t/may-i-ask-in-ristretto-how-can-i-sync-with-database/5795/1 "2020-01-10T08:26:41Z")

</div>

Q: Is that possible that I use Ristretto as cache, and Ristretto automatically handle the data to Database? Thanks.

Description:  
I am using Golang to write some webapp. Would like to try the cache library to meet performance requirement. Then I see the benchmark of Ristretto. I am very interested in it and would like to try and evaluate it. Considering finally the data will be persisted in postgres in our architecture, I am thinking is it possible for the webapp to access Ristretto, then Ristretto handle Postgresql itself to minimum the development work and get a good performance. Our major scenario would very likely to be 10% write and 90% read.

---

<div class="post-metadata">

**Author:** ![martinmr](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/martinmr/32/1408_2.png) [@martinmr](https://discuss.dgraph.io/u/martinmr)\
**Post date:** [January 10, 2020, 6:47pm UTC](https://discuss.dgraph.io/t/may-i-ask-in-ristretto-how-can-i-sync-with-database/5795/2 "2020-01-10T18:47:51Z")

</div>

Ristretto can’t do this. Even if the interfaces to execute some function on Sets and Deletes existed, you’d still need to provide the logic for those functions. Specifically, Ristretto is a key-value cache and Postgres is a SQL database. Ristretto cannot do the translation between these two formats on its own.

---

<div class="post-metadata">

**Author:** ![fr-zec](https://avatars.discourse-cdn.com/v4/letter/f/73ab20/32.png) [@fr-zec](https://discuss.dgraph.io/u/fr-zec)\
**Post date:** [January 15, 2020, 3:42am UTC](https://discuss.dgraph.io/t/may-i-ask-in-ristretto-how-can-i-sync-with-database/5795/3 "2020-01-15T03:42:55Z")

</div>

I see. Thanks for your feedback.

---

<div class="post-metadata">

**Author:** ![marvin-hansen](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/marvin-hansen/32/2409_2.png) [@marvin-hansen](https://discuss.dgraph.io/u/marvin-hansen)\
**Post date:** [February 18, 2020, 3:04pm UTC](https://discuss.dgraph.io/t/may-i-ask-in-ristretto-how-can-i-sync-with-database/5795/4 "2020-02-18T15:04:43Z")

</div>

@fr-zec

try varnish in between your app & DB.

[https://varnish-cache.org/intro/index.html#intro](https://varnish-cache.org/intro/index.html#intro)

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex007/uploads/dgraph/original/2X/2/2b38fdece2abe5814f2e51bee69d1e67fc304b0a.png) [@system](https://discuss.dgraph.io/u/system)\
**Post date:** [March 31, 2020, 7:04am UTC](https://discuss.dgraph.io/t/may-i-ask-in-ristretto-how-can-i-sync-with-database/5795/5 "2020-03-31T07:04:45Z")

</div>

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