Can Boltdb use as a cache

Hi All,
I am writing an twitter clone, using Postgres for database and wondering if I could use Boltdb as cache, for tweets, and etc. and how to use it.


BoltDb repo is archived, so I would not build any new software using it, better focus to some distributed storage like Aerospike or eventually Redis.

there is a etcd-io fork

Does it make sense to write “twitter clone” using embedded KV?

I want to use it as a cache, to reduce some of load on sql db, faster access.
maybe it doesn’t make sense but I’ll learn something. as a new programmer the more bells whistle I put the more I’ll learn

Yes, but imagine that your project starts well and you need to scale it. You should anyways use an abstraction layer (ijterface) over KV storage and then you can eventually use bolt-like implementation which can be easily replaces with something distributed in the future.

I agree, but wouldn’t be easier to build on Boltdb then use abstraction layer
fyi: never wrote any software.

If you want cache in memory, you can use sync.Map as well.

sync.Map might not be a good fit because, assuming there is high read/write, management of memory, expired keys, etc.

Well, that’s another thing :smile: You may consider this one as well, if you want embedded KV:

this look like better alternative then Boltdb however how can I use this like a cache. how can i expire the object, delete when expired?

Check here

Redis is a good alternative. Often used as a cache and is very easy to work with :slight_smile:

thanks, when skimed the docs, I missed that

I wanted go based so its little easier to setup and deploy, thanks

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