setTimeout can be used, but it will be executed in the background and you
don't have control over when it is done. Also, if you trigger that from a
specific request, then you can't get the results before that request ends.

Further, it will have probably hold cleaning up the scopes associated with
that specific request until setTimeout get executed. Hence, please take
those into consideration.

Depending on you requirement, you can also think of implementing a Java
class which do the caching and expose a util method, so Jaggery can fetch
from the cache. In this way, you can get more control over concurrency
control etc.

/Ruchira

On Fri, Jun 12, 2015 at 11:03 AM, <danush...@wso2.com> wrote:

>  Hi
> Currently in AF jaggery application we are using the block model. In the
> index page we were loading the permissions to cache. So I moved the caching
> to a separate thread using setTimeout fuction. Seems there is an
> performance improvement after that. My question is whether that's the
> correct thing to do. Is it ok to use setTimeout function there?
>
> Thanks & Regards
> Danushka Fernando
> Senior Software Engineer
> WSO2 inc. http://wso2.com/
> Mobile : +94716332729
>
>


-- 

*Ruchira Wageesha**Technical Lead*
*WSO2 Inc. - lean . enterprise . middleware |  wso2.com <http://wso2.com>*

*email: ruch...@wso2.com <ruch...@wso2.com>,   blog:
ruchirawageesha.blogspot.com <http://ruchirawageesha.blogspot.com>,
mobile: +94 77 5493444*
_______________________________________________
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to