twitter / pelikan

Pelikan is Twitter's unified cache backend
Apache License 2.0
1.94k stars 176 forks source link

Some update for JSegcache #452

Open JunchengYTwitter opened 2 years ago

JunchengYTwitter commented 2 years ago

This PR contains multiple things (let me know if you want to split them)

  1. Add get_age in segments, then add a new field age in Item so that we can return age to caller.
  2. Add RichItem to return item_info and item_info_ptr, these two are used to support opportunistic concurrency control. Not sure adding a new struct is better than adding the fields to Item, but given there might be fields (like these) that we often do not need, creating a new struct might be better.
  3. add a call to expire before we evict, this avoids the problem that users may forget to call expire.
  4. add key size check when inserting to the cache.
CLAassistant commented 2 years ago

CLA assistant check
All committers have signed the CLA.

brayniac commented 2 years ago

@JunchengYTwitter - this looks good overall. Just needs rustfmt. I'm okay with this remaining a single PR.

JunchengYTwitter commented 2 years ago

updated