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 settled for a sorted array of cache entries plus an AA to map urls to indices into this array.

https://github.com/qznc/d-github/commit/46c013c650d2cf34911ad3e10308ee6a0b5e3690#diff-24abb1e4df591f2d28947bbde1a09220R79

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. I think this way should be faster (if imposing a max number of cache entries is feasible, I don't know your use cases).

Reply via email to