1. David Larlet
  2. django-storages
  3. Pull requests

Pull requests

#22 Open
Repository
alanjds
Branch
s3_bucket_cache
Repository
david
Branch
default

Entries cache more usefull, and safer

Bitbucket cannot automatically merge this request.

The commits that make up this pull request have been removed.

Bitbucket cannot automatically merge this request due to conflicts.

Review the conflicts on the Overview tab. You can then either decline the request or merge it manually on your local system using the following commands:

hg update default
hg pull -r s3_bucket_cache https://bitbucket.org/alanjds/django-storages
hg merge s3_bucket_cache
hg commit -m 'Merged in alanjds/django-storages/s3_bucket_cache (pull request #22)'
Author
  1. Alan Justino da Silva
Reviewers
Description

Entries cache got more usefull and safe. It caches the know entries, proxies the bucket.get_key and got flushed at bucket.delete_key. It is safe from keys getting added behind your back.

If saved me from a lot of HEAD requests

Comments (3)

  1. David Larlet repo owner

    Hello,

    Can you detail the workflow of your use-case, I can't see exactly what is cached and when it's useful to avoid extra requests.

    Thanks for your contribution, David

  2. Alan Justino da Silva author

    Hi!

    Disclamer: I coded this based on another fork of some pal, and it was 12 months ago.

    What it caches:

    _entries already stores the past known entries that exists on the bucket. When hacking, I perceived myself repeating the task of checking the entries cache, than I DRYed it. DRY makes it safer for not letting me do mistakes.

    When it saves requests:

    Its pre-existing code, with no changes on me: _entries is checked when e.g. .exists() is called. If some name is tryed with .exists() and then .read(), It does 2 requests. If it caches the known entries, and I pre-populate it with all the bucket entries, than It saved-me 1 request per first read per file.

    Maybe the pull-request got a bad name, but I cannot imagine a better one now. Perhaps: "DRYed the use of cached known _entries"

    Seriously, I started to got confused before this refactor. I needed it to think about implementing other stuff.

  3. Ian Lewis

    This pull request is appreciated but the s3boto module has undergone a lot of changes which makes merging this on our side a bit difficult. If you could merge this pull request with the most recent code that would be helpful for getting this pull-request approved.