Hi Harsha,

This is part of the specification. You can see the "Age header"

https://tools.ietf.org/html/rfc2616#page-124

thanks,
Dimuthu


On Wed, Jan 24, 2018 at 9:19 PM, Harsha Kumara <hars...@wso2.com> wrote:

>
>
> On Wed, Jan 24, 2018 at 3:34 PM, Keerthika Mahendralingam <
> keerth...@wso2.com> wrote:
>
>> Hi All,
>>
>> I need to get the cached response fetched time from origin server which
>> is returned in the BE response with Date header. When I debugged the
>> cache-mediator code, I found that when caching the response Date header is
>> added to the cache. But when I retrieve the cached response for the
>> subsequent request, Date header is removed from the cached response.
>>
>> This is due to we are removing the Date header from the response [1] and
>> send a new Date header with the response to the user. If we set the
>> preserveHeaders(in passthru-http.properties), I was able to get the Date
>> header from the cached response as well.
>>
>> So, as I need the response fetched time to calculate the TTL value of the
>> cached response, I am planning to add a property to the cached response to
>> store the fetched time and use it to calculate the TTL. Or do we need to
>> suggest the user to set the preserve header?
>>
> I think adding a property is better rather adding header to the response.
>
>>
>>
>> [1]. https://github.com/wso2/wso2-synapse/blob/master/module
>> s/transports/core/nhttp/src/main/java/org/apache/synapse/
>> transport/passthru/util/PassThroughTransportUtils.java#L160
>>
>> Thanks,
>> Keerthika.
>>
>> On Tue, Jan 23, 2018 at 8:26 PM, Keerthika Mahendralingam <
>> keerth...@wso2.com> wrote:
>>
>>> Hi All,
>>>
>>> I am trying to add an Age header when returning the cached response(as
>>> discussed in [1]). I am following the steps as follows:
>>>
>>>    - If the response doesn't have the Date header, add Date header
>>>    (with current time) when caching the response[2].
>>>    - For the subsequent request, get the Date header value of the
>>>    cached response, timeout and current requested time and find the TTL 
>>> value
>>>    as:
>>>
>>> TTL = difference ((DateHeaderValue + timeout), CurrentTime)
>>>
>>>
>>>    - Set the TTL value as Age header.
>>>
>>> Please let me know if you have any concerns on this.
>>>
>>> [1]. [Architecture][RRT] Improving caching based on cache-control and
>>> ETag headers
>>> [2]. https://tools.ietf.org/html/rfc2616#page-124
>>>
>>> Thanks,
>>> Keerthika.
>>> --
>>> <dev-requ...@wso2.org>
>>> Keerthika Mahendralingam
>>> Software Engineer
>>> Mobile :+94 (0) 776 121144 <+94%2077%20612%201144>
>>> keerth...@wso2.com
>>> WSO2, Inc.
>>> lean . enterprise . middleware
>>>
>>
>>
>>
>> --
>> <dev-requ...@wso2.org>
>> Keerthika Mahendralingam
>> Software Engineer
>> Mobile :+94 (0) 776 121144 <+94%2077%20612%201144>
>> keerth...@wso2.com
>> WSO2, Inc.
>> lean . enterprise . middleware
>>
>
>
>
> --
> Harsha Kumara
> Software Engineer, WSO2 Inc.
> Mobile: +94775505618 <077%20550%205618>
> Blog:harshcreationz.blogspot.com
>



-- 
Dimuthu Leelarathne
Director, Solutions Architecture

WSO2, Inc. (http://wso2.com)
email: dimut...@wso2.com
Mobile: +94773661935
Blog: http://muthulee.blogspot.com

Lean . Enterprise . Middleware
_______________________________________________
Architecture mailing list
Architecture@wso2.org
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture

Reply via email to