Code Monkey home page Code Monkey logo

falcon-caching's People

Contributors

alisaifee avatar zoltan-fedor avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Forkers

alisaifee

falcon-caching's Issues

falcon-caching/setup.py not found

Running into an error when installing the latest version of falcon-caching

[appname/app app 1/1] RUN pip3 install -r requirements.txt --src /usr/local/src:
#23 0.254 + pip3 install -r requirements.txt --src /usr/local/src
#23 1.235 Collecting pynamodb (from -r requirements.txt (line 1))
#23 1.596   Downloading https://files.pythonhosted.org/packages/74/2b/524ffd7a9d2f816e0be468f38a6dd5fc737bd16cb1e907f1a34fd387906e/pynamodb-5.2.1-py3-none-any.whl (57kB)
#23 1.654 Collecting falcon==2.0.0 (from -r requirements.txt (line 2))
#23 1.954   Downloading https://files.pythonhosted.org/packages/19/30/edff5a1fea7a8e9876c8391e170263e1bb207875b6a65cd619818487b27b/falcon-2.0.0.tar.gz (397kB)
#23 2.466 Collecting falcon-caching (from -r requirements.txt (line 4))
#23 2.660   Downloading https://files.pythonhosted.org/packages/4d/cf/16666df8f3899194241bf1dfc04e6bb4e602ec3586b8dbea4e2cc55190ee/falcon-caching-1.0.1.tar.gz (78kB)
#23 2.879     Complete output from command python setup.py egg_info:
#23 2.879     Traceback (most recent call last):
#23 2.879       File "<string>", line 1, in <module>
#23 2.879       File "/usr/lib/python3.6/tokenize.py", line 452, in open
#23 2.879         buffer = _builtin_open(filename, 'rb')
#23 2.879     FileNotFoundError: [Errno 2] No such file or directory: '/tmp/pip-build-qbj_2599/falcon-caching/setup.py'
#23 2.879
#23 2.879     ----------------------------------------
#23 2.896 Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-qbj_2599/falcon-caching/
------
failed to solve: executor failed running [/bin/bash -xc pip3 install -r requirements.txt --src /usr/local/src]: exit code: 1

Our falcon version has been pinned to 2.0.0, wondering if that has anything to do with this failure.

client.behaviors is missing

Hi,

I'm using pylibmc and the docs specify:

# Break convention and set options on the _client object directly. For pylibmc behaviors: cache.cache._client.behaviors["tcp_nodelay"] = True

But when i try to use it i got this error:

AttributeError: 'Client' object has no attribute 'behaviors'

I'm using the last version available (0.3.1)

Request body as cache key issues

It is quite unusual for GET or HEAD requests to have a non-empty body at all, but even for cached responders that do handle the request body, the stream would have been emptied and left at EOF if completely consumed.

Therefore, either would these responders interfere with the cache key logic, or the cache middleware would consume the stream leaving nothing for requests.

Ref:

request_body = req.stream.read(req.content_length or 0)

Adapt to class-based req.context

Hello @zoltan-fedor,
and thanks for porting/developing this caching component ๐Ÿ‘ ! (And thanks for also adding it to our Wiki, that's the way I discovered it).

Btw, do not hesitate to join our Gitter channels, such as falconry/dev ๐Ÿ˜‰

Re this caching component, I just had a couple of notes which I thought filing as issues ๐Ÿ™‚

The first one comes here:
In Falcon 2.0, the default context type for req.context and resp.context was changed to a bare class, i.e. it is now preferred to write req.context.cached = True etc.

Response headers are not cached

Unless I misinterpreted the middleware code, it seems that response headers are not cached:

This is probably fine as an MVP if documented as that could probably be patched in other middleware processing responses, but it seems that not even the Content-Type is cached, meaning all cached responses would use the default Content-Type (application/json in vanilla Falcon).

You could also take a look at my Falcon ASGI tutorial (which I hacked together very quickly a couple days ago, so don't expect super high quality, particularly the tutorial text is dull and repetitive), I was demoing a simple cache there: https://github.com/vytas7/falcon-asgi-example/blob/070d23306b2a15c7ad395f8ff72f01cf6ef4e5c4/asgilook/asgilook/cache.py#L27 (the concept could be easily extended to include all headers).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.