Reputation: 41
I've got the following problem: I've got a web application and the functionality is : A user needs to review documents assigned to him. After the user reviews the doc he will mark the document as 'reviewed'. The documents assigned to the user maybe in 1000s. There will be an option 'non-reviewed' documents. So, when the user clicks on this he will get the list of all the documents which are non-reviewed (which could be 1000s). E.g he gets Doc1,Doc2,Doc3,Doc4,Doc5,Doc6,Doc7,Doc8,Doc9,Doc10. He begins with Doc1. He may/may not review Doc1 and then go to Doc2 for reviewing purpose. Now he should be able to navigate with 'next'/ 'previous' option to documents in the list. Now the problem is - if i'm in the midst of reviewing the Doc5 and I want to go the previous document (Doc4 which is reviewed) it needs to be kept in the cache for that review session so that it can go back to previous reviewed doc. If i keep it in cache all the documents accessed till now and which may run in 1000s then there is a possibility of outofmemory error if there are large number of users working on the common set of documents. How do i go about resolving this issues.
Thanks,
UPDATE:
I think I should be more clear as to how it should work - Whenever user is in the 'non-reviewed' session he gets all the non-reviewed documents (e.g say 10 documents from Doc1-10). Now he should be able to navigate thru' these 10 documents (next/previous), irrespective of those documents which are tagged as 'reviewed' in this 'non-reviewed session'. Suppose while navigating thru' these documents he tags Doc 2 as 'reviewed' and he comes out of the non-reviewed session and next time again selects 'non-reviewed' he should get 9 documents except for Doc 2. But, if he is still in non-reviewed session and he tags Doc 3 as reviewed and then moves to Doc 4 , he should be able to go back to Doc 3 , even if it 'reviewed'. Do we maintain a unique session for these set of documents selected in 'non-reviewed' session so that we can navigate thru' it during the non-reviewed session
Upvotes: 1
Views: 132
Reputation: 70949
Keep a sliding cache window. Look below for details
..., 34, 35, [36, 37, <38>, 39, 40], 41, 42, ...
(brackets indicate the cache window, the currently viewed item is #38)
and as a person presses next, the window gets updated
..., 34, 35, 36, [37, 38, <39>, 40, (41)], 42, ...
(download #41 in the background while the person browses #39, the current item)
This will have the effect of not slowing down small range changes, and hiding download times if the person lags a bit on a particular document. It also allows you to balance the size of the window with the available memory.
Upvotes: 3