Hi Dulanja,

Yes what you have stated is the way it was sorted in the "Shared Memory
Subscription". Look at the following file for an example.

https://github.com/wso2-dev/carbon-utils/blob/master/components/event/org.wso2.carbon.event.core/src/main/java/org/wso2/carbon/event/core/sharedmemory/SharedMemorySubscriptionStorage.java

Shazni Nazeer

Senior Software Engineer

Mob : +94 777737331
LinkedIn : http://lk.linkedin.com/in/shazninazeer
Blog : http://shazninazeer.blogspot.com

On Sun, Jan 11, 2015 at 4:57 PM, Subash Chaturanga <sub...@wso2.com> wrote:

> Hi Dulanja,
> AFAIR what we did was the one you told. You can check how we created
> registry subscription cache with the help of any G-Reg folk.
>
> On Sun, Jan 11, 2015 at 2:18 PM, Dulanja Liyanage <dula...@wso2.com>
> wrote:
>
>> I checked the caching related to Authentication Framework in IS, and it
>> seems the issue is, only the expiry by last accessed time is set. Expiry by
>> last modified time is not set.
>>
>> Following is that code segment in
>> org.wso2.carbon.identity.application.common.cache.BaseCache:
>>
>> stringCacheBuilder = cacheManager.<String,
>>> V>createCacheBuilder(cacheName).
>>>
>>> setExpiry(CacheConfiguration.ExpiryType.ACCESSED,
>>>                                             new
>>> CacheConfiguration.Duration(TimeUnit.SECONDS, cacheTimeout)).
>>>                                     setStoreByValue(false);
>>> cache = stringCacheBuilder.build();
>>
>>
>> So CacheImpl defaults the expiry by last modified time to 15mins. And the
>> below code expires the cache entry after 15mins because of that.
>>
>>  if (now - lastAccessed >= accessedExpiryDuration || now - lastModified
>>> >= modifiedExpiryDuration) {
>>
>>        expire(key);
>>
>>        ...
>>>  }
>>
>>
>> So we should set both expiry types when creating a cache. Else, the one
>> that we don't set will get defaulted to 15mins and entry will get removed
>> after that time.
>>
>> On Sun, Jan 11, 2015 at 9:00 PM, Dulanja Liyanage <dula...@wso2.com>
>> wrote:
>>
>>> Hi Subash,
>>>
>>> Did this work for you? I checked with IS and seems it's not working.
>>>
>>> Thanks,
>>> Dulanja
>>>
>>> On Fri, Aug 29, 2014 at 4:27 PM, Subash Chaturanga <sub...@wso2.com>
>>> wrote:
>>>
>>>> Hi Azeez,
>>>> Yes I also noticed identity components also uses this. But the prob is
>>>> I am not sure whether they have tested this cache invalidation timeout
>>>> specifically or they have a use case as such. But for us we do have. For
>>>> resource/path caches we have NOT used the proper way of building the cache
>>>> with expiry time. But for a new fix, we added such cache for notifications
>>>> and we see all cache values expires in 15mins even though I have set it to
>>>> 1000 days.
>>>>
>>>>
>>>> On Fri, Aug 29, 2014 at 4:21 PM, Afkham Azeez <az...@wso2.com> wrote:
>>>>
>>>>> setExpiry should work. AFAIK, the IS team is also using this.
>>>>>
>>>>>
>>>>> On Fri, Aug 29, 2014 at 12:38 PM, Subash Chaturanga <sub...@wso2.com>
>>>>> wrote:
>>>>>
>>>>>> Hi Azeez,
>>>>>> In turing kernel, can we do $subject. We found "setExpiry" in your
>>>>>> blog post  and following is the code we use, but we noticed it still
>>>>>> timeouts in 15mins. Is there new API to do this or are we missing 
>>>>>> something
>>>>>> ?
>>>>>>
>>>>>> CacheManager manager =
>>>>>> Caching.getCacheManagerFactory().getCacheManager("inMemoryEventCacheManager").getCache("inMemoryEventCache").getCacheManager();
>>>>>>
>>>>>>         if(inMemoryEventCacheInit) {
>>>>>>             return
>>>>>> Caching.getCacheManagerFactory().getCacheManager("inMemoryEventCacheManager").getCache("inMemoryEventCache");
>>>>>>         } else {
>>>>>>             inMemoryEventCacheInit = true;
>>>>>>             return manager.<Integer,
>>>>>> SharedMemoryMatchingManager>createCacheBuilder("inMemoryEventCacheManager").setExpiry(CacheConfiguration.ExpiryType.MODIFIED,
>>>>>>                     new
>>>>>> CacheConfiguration.Duration(TimeUnit.DAYS,1000)).setStoreByValue(false).build();
>>>>>>         }
>>>>>>
>>>>>> --
>>>>>> Thanks
>>>>>> /subash
>>>>>>
>>>>>> *Subash Chaturanga*
>>>>>> Senior Software Engineer & Lead WSO2 Governance Registry
>>>>>> Platform TG; WSO2 Inc. http://wso2.com
>>>>>> Contact:
>>>>>> email: sub...@wso2.com
>>>>>> blog:  http://subashsdm.blogspot.com/
>>>>>> twitter: @subash89
>>>>>> phone: +9477 2225922
>>>>>> Lean . Enterprise . Middleware
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> *Afkham Azeez*
>>>>> Director of Architecture; WSO2, Inc.; http://wso2.com
>>>>> Member; Apache Software Foundation; http://www.apache.org/
>>>>> * <http://www.apache.org/>*
>>>>> *email: **az...@wso2.com* <az...@wso2.com>
>>>>> * cell: +94 77 3320919 <%2B94%2077%203320919> blog: *
>>>>> *http://blog.afkham.org* <http://blog.afkham.org>
>>>>> *twitter: **http://twitter.com/afkham_azeez*
>>>>> <http://twitter.com/afkham_azeez>
>>>>> * linked-in: **http://lk.linkedin.com/in/afkhamazeez
>>>>> <http://lk.linkedin.com/in/afkhamazeez>*
>>>>>
>>>>>
>>>>> *Lean . Enterprise . Middleware*
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Thanks
>>>> /subash
>>>>
>>>> *Subash Chaturanga*
>>>> Senior Software Engineer & Lead WSO2 Governance Registry
>>>> Platform TG; WSO2 Inc. http://wso2.com
>>>> Contact:
>>>> email: sub...@wso2.com
>>>> blog:  http://subashsdm.blogspot.com/
>>>> twitter: @subash89
>>>> phone: +9477 2225922
>>>> Lean . Enterprise . Middleware
>>>>
>>>> _______________________________________________
>>>> Dev mailing list
>>>> Dev@wso2.org
>>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>>
>>>>
>>>
>>>
>>> --
>>> Dulanja Liyanage
>>> WSO2 Inc.
>>> M: +94776764717
>>>
>>
>>
>>
>> --
>> Dulanja Liyanage
>> WSO2 Inc.
>> M: +94776764717
>>
>
>
>
> --
> Thanks
> /subash
>
> *Subash Chaturanga*
> Senior Software Engineer
> Platform TG; WSO2 Inc. http://wso2.com
> Contact:
> email: sub...@wso2.com
> blog:  http://subashsdm.blogspot.com/
> twitter: @subash89
> phone: +9477 2225922
> Lean . Enterprise . Middleware
>
> _______________________________________________
> Dev mailing list
> Dev@wso2.org
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>
_______________________________________________
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to