You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I noticed that shaj13/libcache's documentation says that lru.New() initializes a non-thread safe cache (https://github.com/shaj13/libcache/blob/master/lru/lru.go#L15) and I couldn't find any code to handle thread safety in go-guardian so I'm wondering, is go-guardian thread-safe? Can it be used in the request path of a go web server safely?
The text was updated successfully, but these errors were encountered:
@amorey thank you for reaching out, shaj13/libcache's and go-guardian, are operate completely independently.
go-guradian does not implement the underlying cache it only exposes an interface so the user can write their own implementation or use libcache.
However, go-guradian and libcache threaded safe and it's already running in production.
Regarding your question, all subpackage (lru, mru, etc..) initializes a non-thread safe, but the parent pkg offers a safe thread cache see example so the user can choose a safe cache or unsafe cache.
@shaj13 Thanks for your quick reply! I see, I was confused by the New() method in the lru package which returns a nonsafe cache but I see now that libcache.LRU.New() actually returns a thread-safe wrapper from the libcache package. Thanks again for help.
I noticed that shaj13/libcache's documentation says that lru.New() initializes a non-thread safe cache (https://github.com/shaj13/libcache/blob/master/lru/lru.go#L15) and I couldn't find any code to handle thread safety in go-guardian so I'm wondering, is go-guardian thread-safe? Can it be used in the request path of a go web server safely?
The text was updated successfully, but these errors were encountered: