Skip to content

Responses are not cached #32

Closed
Closed

Description

@lkorth

I'm running into some strange issues that I'm having a hard time tracking down, I'm wondering if anyone else has encountered something similar. This issue is present with the port and the built in HttpResponseCache.

I'm making a series of api calls to my server and they are being cached so the next time the user loads a portion of the app the cached response is used. It works very well, but there are a few times when the response does not get cached (This is not a max cache size issue, the cache is initialized at 10mb and the responses are a few hundred k of json and they are not cached even when the cache is empy).

It seems like it is related to the size of the response as when I reduce the number of records I'm returning from the server the response is successfully cached and when I step the number of results up there is a point when it stops caching. One response is 7.83k and it is successfully cached, but increasing the number of results in the response which results in a 17.6k response results in a failure to cache. To make it even more complicated, on an older device it is happening more often.

I'm not familiar with DiskLruCache, but is this a device memory issue?

Activity

  1. DanielLukic commented on Mar 10, 2013

    @DanielLukic

    See if the server uses gzip as content-encoding and chunked as transfer-encoding. You might have this problem:

    #33

    Try removing the available() check in line 68 of ChunkedInputStream and see if that fixes your problem.

    (See different behavior, depending on the response size, could indicate chunked/non-chunked transfer encoding being used..)

  2. lkorth commented on Mar 11, 2013

    @lkorth
    Author

    Great job, after removing the .available() check I am unable to reproduce my cache misses.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions