monix / shade

Memcached client for Scala
MIT License
106 stars 19 forks source link

When to call close? #51

Closed gitleet closed 7 years ago

gitleet commented 7 years ago

Hello,

I am using shade in a play application. I am currently using a singleton for my cache instance:

val cache = Memcached(...)

Is it ok to use it like this?

And when my application ends, I will then call cache.close? Is this the best practise?

lloydmeta commented 7 years ago

You should definitely call close() to cleanup when your Play app shuts down. I think the best way to do it is via ApplicationLifecycle (see the official docs)

gitleet commented 7 years ago

That is what I am doing, just confirming thanks!