Skip to main content
Stack Overflow
  1. About
  2. For Teams
Filter by
Sorted by
Tagged with
1 vote
1 answer
2k views

I have dug myself into a hole. I have been chasing a bug for a while that I finally concluded today must be in my version of expo or react or react native. But that is another issue. So I started ...
-1 votes
1 answer
93 views

I wrote quick impl of LRU cache, where all the data (eg key -> value pairs) is stored in unordered map, and the order list simply stored pointers to these items. if it was regular C data structs, ...
Pavel P's user avatar
  • 17.3k
0 votes
1 answer
80 views

I want to use lru_cache (or cache, doesn't really matter) to store the results of a very computatively intensive function of a class. However, it does not work as intended as when I included a print ...
0 votes
1 answer
97 views

get_user_pages() increments the page reference count. And that is why it can pin the page in memory. So I wonder whether the pages obtained by get_user_pages() can be directly recycled or swapped out ...
3 votes
1 answer
167 views

I am solving leetcode LRU design problem - Leetcode LRU: Design a data structure that follows the constraints of a Least Recently Used (LRU) cache. Implement the LRUCache class: LRUCache(int ...
0 votes
0 answers
315 views

I was trying to implement LRU Cache for a Leetcode question. My final code is below and it works fine. However, my first choice was deque instead of list with exactly same procedure and I was getting ...
NB_1907's user avatar
  • 162
0 votes
1 answer
60 views

I am using functools.lru_cache to implement Fibonacci using memoization. But I do not understand the number of hits that my output generates. My code is as follows: @lru_cache(maxsize=8) def fib(n): ...
0 votes
1 answer
45 views

I have a lambda function which is an api fetching data from the database. I want to add caching to the method itself, with the idea that if the lambda is being invoked it should return the cached ...
0 votes
1 answer
43 views

This is my Benchmark method. static void BM_LRU(benchmark::State &state) { lru_cache* cache = lru_init(state.range(0)); std::vector<int> pages = generateRandomPages(state.range(1)); ...
4 votes
3 answers
204 views

I'm trying to solve https://leetcode.com/problems/lru-cache/description/. I'm using treeset to save unique keys and order them based on when it's inserted. The treeset is not returning elements in the ...
0 votes
1 answer
101 views

I encountered this problem on LeetCode, which needs us to implement the LRU cache functions "get" and "put" in O(1) average time complexity. I tried the similar method here, in ...
0 votes
1 answer
64 views

I'm trying to figure out the most robust caching scheme for my particular use case. I have a class that matches temporal data. The data is on a per day granularity (there's no intraday data). class ...
u2j4's user avatar
  • 15
1 vote
1 answer
93 views

I am using functools.lru_cache to implement Fibonacci using memoization. But I do not understand the number of hits that my output generates. My code is as follows: @lru_cache(maxsize=8) def fib(n): ...
0 votes
0 answers
101 views

I was implementing LRU Cache in C++. Here is what the class looks like, class LRUCache { private: int capacity; list<pair<int,int>> memory; // key,value ...
0 votes
1 answer
181 views

I'm trying to store a list of things in the Vert.x cluster shared data, where the list if kind of like a queue, but things drop off of the queue based on a limit of number of elements - basically the ...

15 30 50 per page
1
2 3 4 5
...
22

AltStyle によって変換されたページ (->オリジナル) /