Allow PartitionedCache to move keys on insert

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Query Optimization
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      PartitionedCache currently takes keys by const& and forwards them into the underlying LRU cache, which also accepts keys by const&. As a result, inserting an rvalue key still forces a copy when the key is stored in the cache.

      This is mostly an API/implementation mismatch: the cache must own a key internally, but it should be able to move that key into storage when the caller provides an rvalue.

      Proposed improvement:

      • Add rvalue overloads for PartitionedCache::put() and the underlying LRU add() path
      • Use the key by reference for partition selection / duplicate lookup before moving it
      • Move the key into the owned list/node storage at the final insertion point

      This would preserve current behavior for lvalue callers while avoiding an unnecessary key copy for rvalue callers.

            Assignee:
            Unassigned
            Reporter:
            Ben Shteinfeld
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: