DEV Community


Discussion on: Implementing an LRU Cache

turnerj profile image
James Turner

Thanks for the reply. Do you think it is worth measuring the actual item size or do you think it adds unnecessary complexity to a caching solution?

I ask this because I have my own caching solution in C# and I am contemplating calculating the item size. Problem is, calculating the size remotely accurately is both time expensive and memory intensive (eg. serializing the whole thing to a string and measuring the length allocates a lot of memory).

Thread Thread
katkelly profile image
Katherine Kelly Author

Personally, I think it adds unnecessary complexity and wouldn't do it myself but I think it's great you're considering the tradeoffs. Best of luck with whatever you choose for your caching solution!

Forem Open with the Forem app