[ 
https://issues.apache.org/jira/browse/HTTPCLIENT-427?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12863495#action_12863495
 ] 

David Mays commented on HTTPCLIENT-427:
---------------------------------------

The idea behind Variant URIs is that for a resource that has Vary response 
headers, we store a "parent" cache entry, which has pointers (variant URIs) to 
"child" entries. The child entries will contain the "variable" content for that 
resource. So the parent entry becomes the map to find a given child entry, 
where the URI (cache key) has had a string like {Content-Encoding:gzip} 
prepended to it

So you might have a parent entry like this:

"http://www.example.com/foo";

With children like these:

"{Content-Encoding:gzip}http://www.example.com/foo"; (Caused by a request that 
had Accept-Encoding:gzip header)
"{Content-Encoding:identity}http://www.example.com/foo"; (Caused by a request 
that had Accept-Encoding:identity header)

The idea of keeping the list of variant children with the parent entry is so 
that we can clean up all child entries when a parent is invalidated. It 
prevents orphan cache entries.

Regarding the atomic updates, we had also started working on a patch for that, 
where CacheEntry had a new constructor that took everything you need, instead 
of the HttpResponse. Obviously all the other setters were to be removed also. 
This way, every time a cache entry is "pulled" from the cache, it is 
effectively a copy, rather than a reference.

The CacheEntryUpdater class would have to be changed slightly to work with 
this, but would not be especially difficult to do.

Dave


> Implement a cache to perform real request only when needed
> ----------------------------------------------------------
>
>                 Key: HTTPCLIENT-427
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-427
>             Project: HttpComponents HttpClient
>          Issue Type: Improvement
>          Components: HttpClient
>         Environment: Operating System: Linux
> Platform: PC
>            Reporter: Marc Guillemot
>             Fix For: 4.1 Alpha2
>
>         Attachments: caching_client.zip, httpclient-cache.zip
>
>
> Browsers may cache received content according to the values of different
> response headers. It would be great if HttpClient could do the same.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to