Commit Graph

36 Commits

Author SHA1 Message Date
Derrick J. Wippler
f647580b77 Improve HTTP error handling 2023-06-12 11:42:59 -05:00
Derrick J. Wippler
bde4250129
Fix LRU to correctly update expire on value replace (#56) 2022-12-20 11:35:12 -06:00
Nathan Johnson
8c6aae6360 Removes hard dependency on logrus for logging
Provides backwards compatibility with existing logrus via SetLogger() method

Introduces a Logger interface that others can implement for other
structured loggers such as zerolog.

Add SetLoggerFromLogger method that allows caller to pass in an implementation
of the new Logger interface.

Bumps the golang.org/x/sys dependency since tests fail to run on go 1.18 with the old version.

adding a test case for LogrusLogger

adding benchmark, add WithFields method because it's a lot faster apparently
2022-06-01 19:16:44 -05:00
Leo Antunes
f0dbe185e0
feat: do not count context cancelation as peer error 2022-05-18 08:27:27 +02:00
Derrick Wippler
1e232d778c Group.Set() now populates the main cache, and optionally the hotcache 2021-05-01 17:02:17 -05:00
censhin
3e480ca15c refactor(all): changing the value passed and stored as a byte slice 2021-04-30 11:23:41 -04:00
censhin
a88b9ce0a6 feat(all): setting a ByteView after marshaling the value into a byte buffer 2021-04-30 11:09:01 -04:00
censhin
fa896fa6c1 feat(groupcache.go): adding duration hardcoded at 60 minutes, will need to parameterize this 2021-04-30 02:22:05 -04:00
censhin
7b47233b4b feat(all): adding setter to cache a specific value 2021-04-29 17:21:31 -04:00
Derrick J. Wippler
829b71f0ed
Merge pull request #18 from Tommy-42/tommy-42/add_metrics_and_logger
Add new metric And logger possiblity for peers error
2020-07-09 10:29:42 -05:00
Tommy PAGEARD
6308e62bbb style(metrics): rename get from peers stats 2020-07-08 19:01:58 +02:00
Tommy PAGEARD
fb2028f2ff fix(): get URL from httpGetter instead of httpPool 2020-07-08 18:59:59 +02:00
Derrick J. Wippler
26cd2cefd5
Merge pull request #15 from inhuman/master
DeregisterGroup
2020-07-08 11:45:42 -05:00
Tommy PAGEARD
ae2e156f19 fix(metrics): use backward compatible time computation for duration 2020-07-08 16:49:30 +02:00
Tommy PAGEARD
3f7232faca feat(peer): add GetURL to be able to retrieve peer url 2020-07-08 14:21:49 +02:00
Tommy PAGEARD
b543958475 fix(datarace): pass peer var as param for func literal
peer var was being accessed by scope heritage instead of being passed as param.
making it unsafe to data race.
2020-07-06 18:56:33 +02:00
Tommy PAGEARD
121623bc02 feat(logger): add a new field category in the log 2020-07-06 18:55:56 +02:00
Tommy PAGEARD
14bc5ab47f feat(metrics/logger): add new metric And logger possiblity for peers error
Introducing a new metric GetFromPeersSlowestDuration which will be recording the slowest
call made to getFromPeers.

Introducing SetLogger() to set a logger and allow getFromPeers error to be logged of.
2020-07-06 18:55:17 +02:00
Derek Perkins
3979bf0f99
fix type 2020-06-19 23:51:41 -06:00
Derek Perkins
3f29740e18
fix goroutine race condition 2020-06-19 23:41:42 -06:00
id
f06dad867e feat(add DeregisterGroup method): DeregisterGroup removes group from group pool 2020-05-05 16:03:10 +03:00
Derrick J. Wippler
48a0ce2463 Get() now returns immediately when context is done
* `Get()` now returns immediately when context is done during a groupcache peer
  conversation. Previously `Get()` would call the `Getter` with a done context.
2019-06-10 14:16:39 -05:00
Derrick J. Wippler
8b0de5a71a Changed module paths to reflect breaking change v2 2019-06-03 11:08:54 -05:00
Derrick J. Wippler
054f2178b4 Client keep-alives and hotcache changes
* Now Associating the transport with peer `httpGetter` so we take advantage of
  connection reuse.  This lowers the impact on DNS and improves preformance for
  high request volume low latency applications.
* Now always populating the hotcache. A more complex algorithm is unnecessary
  when the LRU cache will ensure the most used values remain in the cache. The
  evict code ensures the hotcache does not over crowd the maincache.
2019-06-03 10:20:40 -05:00
Derrick J. Wippler
f352930de5 Now using context.Context instead of groupcache.Context 2019-05-30 17:03:06 -05:00
Derrick J. Wippler
2e501aa922 Remove() Now returns the body on non 200 response 2019-05-23 15:09:56 -05:00
Derrick J. Wippler
2ce33c3fea Remove now inits peers if needed 2019-05-23 12:40:01 -05:00
Derrick J. Wippler
4f7e5ecf8c Added support for key removal within a group 2019-04-11 10:50:29 -05:00
Derrick J. Wippler
a4f69dc48c Changed import path to mailgun/groupcache 2019-04-10 15:09:20 -05:00
Derrick J. Wippler
ce8fe99325 Sinks can not accept an expire time 2019-04-09 17:36:03 -05:00
Brad Fitzpatrick
d092608c06 Align Group.Stats properly for 32-bit platforms.
Fixes golang/go#18334
2016-12-16 00:27:18 +00:00
Matthew Denton
b3c0d093a3 portPicker function now takes group name, RegisterPerGroupPeerPicker added to set this function 2016-08-03 12:39:10 -07:00
Shawn Smith
bf5f336156 fix typos 2016-05-15 16:45:38 +09:00
Tipp Moseley
d995f8a668 Fixes a concurrency error in groupcache. Previously, multiple Get
requests could simultaneously result in a load().  Only requests that
enter singleflight Do concurrently would be deduped, so it was possible for
populateCache to be called multiple times for the same key.  That
would result in overcounting nbytes, and eventually leading to a
livelock where nbytes > cacheBytes, but there were no entries in the
cache.

Change-Id: I5b304ce82041c1310c31b662486744e86509cc53
2016-01-27 11:33:35 -08:00
Blake Mizerany
0fb45dacf0 fix doc typo 2013-08-26 16:42:09 -07:00
Brad Fitzpatrick
6dad98a783 initial commit. 2013-07-23 18:03:06 -07:00