On 7/2/16 8:10 AM, qznc wrote:
I want to implement some caching for HTTP GET requests. Basically a map
of URL to content. A cache needs some additional meta data (size, age,
etc).
There seem to be two basic data structures available: Associative array
(AA) or red black tree (RBT).
With AA cache
On Saturday, 2 July 2016 at 12:10:28 UTC, qznc wrote:
With AA cache eviction is inefficient. It requires to sort the
keys of the AA with respect to a field in the value. Stack
No, you just need the hash of the key in the object for many
types of hash-tables. There are many solutions, but here
On Sunday, 3 July 2016 at 17:15:32 UTC, Lodovico Giaretta wrote:
To avoid the ~= operator and reallocations of the cache array,
you could impose a max number of cache entries, preallocate the
array and use it as a circular buffer.
Here's a simple ring buffer I use, feel free to take it
struct
On Sunday, 3 July 2016 at 16:03:51 UTC, qznc wrote:
On Saturday, 2 July 2016 at 12:21:14 UTC, Lodovico Giaretta
wrote:
On Saturday, 2 July 2016 at 12:10:28 UTC, qznc wrote:
Alternatively, any better idea to implement the cache? I
guess there is no off-the-shelf/dub solution.
For now, I settle
On Saturday, 2 July 2016 at 12:21:14 UTC, Lodovico Giaretta wrote:
On Saturday, 2 July 2016 at 12:10:28 UTC, qznc wrote:
Alternatively, any better idea to implement the cache? I guess
there is no off-the-shelf/dub solution.
For now, I settled for a sorted array of cache entries plus an AA
to
On Saturday, 2 July 2016 at 12:10:28 UTC, qznc wrote:
I want to implement some caching for HTTP GET requests.
Basically a map of URL to content. A cache needs some
additional meta data (size, age, etc).
There seem to be two basic data structures available:
Associative array (AA) or red black
I want to implement some caching for HTTP GET requests. Basically
a map of URL to content. A cache needs some additional meta data
(size, age, etc).
There seem to be two basic data structures available: Associative
array (AA) or red black tree (RBT).
With AA cache eviction is inefficient. It