you can only do onDetach on the AbstractDetachableReadOnlyModel, but you
can't do it in IDataProvider if you are to cache the result. Even if you
nullify the object in onDetach, the result list still appear in
IDataProvider. How to nullify the result in IDataProvider? 


Jeremy Thomerson-2 wrote:
> 
> I believe that the onDetach() { result = null; } should take care of that.
> At the end of the request, that will be called and your "cache" will be
> blown away, which means you are as safe as any other way (memory wise),
> because the data is only held for the length of the request.
> 
> You can verify, but I don't think memory will be an issue there.
> 
> -- 
> Jeremy Thomerson
> jthomerson AT users DOT sourceforge DOT net
> 
> On 6/10/07, Lec <[EMAIL PROTECTED]> wrote:
>>
>>
>> Why would want to cache the result? what happened if the results returned
>> are
>> big and if that s not enought, what will happened if 5000 concurrent
>> users
>> are accessing the paging and hence caching a potential big records
>> returned?
>> the memory of the server will be eaten away right?
>>
>>
>> Timo Stamm wrote:
>> >
>> > Steve Knight schrieb:
>> >> If my SortableDataProvider implementation will always return the max
>> >> number
>> >> of results (I'm not using paging), is it safe to have the size()
>> method
>> >> simply return Integer.MAX_VALUE instead of performing a database query
>> to
>> >> count the actual results?
>> >
>> > You shouldn't. It might not give you problems right now, but you break
>> > the contract with the interface.
>> >
>> > You can cache the result so that you do only one query per request to
>> > get both the result size and the result values. Use onDetach to clear
>> > the cache after each request.
>> >
>> >
>> > It should look like this (pseudo-code):
>> >
>> >
>> > private List result;
>> >
>> > void onDetach() {
>> >    result = null;
>> > }
>> >
>> > Iterator iterator(from, to) {
>> >     return getData().iterator();
>> > }
>> >
>> > int size() {
>> >    return result.size();
>> > }
>> >
>> > private Collection getData() {
>> >    if (result == null) {
>> >      result = dbquery(from, to);
>> >    }
>> >    return result;
>> > }
>> >
>> >
>> > Timo
>> >
>> >
>> > -------------------------------------------------------
>> > This SF.Net email is sponsored by xPML, a groundbreaking scripting
>> > language
>> > that extends applications into web and mobile media. Attend the live
>> > webcast
>> > and join the prime developer group breaking into this new coding
>> > territory!
>> >
>> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
>> > _______________________________________________
>> > Wicket-user mailing list
>> > Wicket-user@lists.sourceforge.net
>> > https://lists.sourceforge.net/lists/listinfo/wicket-user
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/IDataProvider.size%28%29-tf1317737.html#a11055063
>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>
>>
>> -------------------------------------------------------------------------
>> This SF.net email is sponsored by DB2 Express
>> Download DB2 Express C - the FREE version of DB2 express and take
>> control of your XML. No limits. Just data. Click to get it now.
>> http://sourceforge.net/powerbar/db2/
>> _______________________________________________
>> Wicket-user mailing list
>> Wicket-user@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/wicket-user
>>
>>
> 
> -------------------------------------------------------------------------
> This SF.net email is sponsored by DB2 Express
> Download DB2 Express C - the FREE version of DB2 express and take
> control of your XML. No limits. Just data. Click to get it now.
> http://sourceforge.net/powerbar/db2/
> _______________________________________________
> Wicket-user mailing list
> Wicket-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wicket-user
> 
> 

-- 
View this message in context: 
http://www.nabble.com/IDataProvider.size%28%29-tf1317737.html#a11055597
Sent from the Wicket - User mailing list archive at Nabble.com.


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to