Skip to content

Commit

Permalink
Add an overview of code layout to Contributing guide
Browse files Browse the repository at this point in the history
  • Loading branch information
JWCook committed Feb 28, 2021
1 parent 685adf6 commit 43f986a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
8 changes: 8 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,11 @@ Releases are built and published to pypi based on **git tags.**
[Milestones](https://github.com/JWCook/aiohttp-client-cache/milestones) will be used to track
progress on major and minor releases.


## Code Layout
Here is a brief overview of the main classes and modules:
* `session.CacheMixin`, `session.CachedSession`: A mixin and wrapper class for `aiohttp.ClientSession`, respectively. There is little logic here except wrapping `_request()` with caching behavior
* `response.CachedResponse`: A wrapper class built from an `aiohttp.ClientResponse`, with additional cache-related info. This is what is serialized and persisted to the cache.
* `backends.base.CacheBackend`: Most of the caching logic lives here, including saving and retriving responses, creating cache keys, expiration, etc. It contains two `BaseCache` objects for storing responses and redirects, respectively. By default this is just a non-persistent dict cache.
* `backends.base.BaseCache`: Base class for lower-level storage operations, overridden by individual backends.
* Other backend implementations in `backends.*`: A backend implementation subclasses `CacheBackend` (for higher-level operations), as well as `BaseCache` (for lower-level operations).
5 changes: 3 additions & 2 deletions aiohttp_client_cache/response.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,9 @@ def from_object(cls, request_info):

@attr.s(slots=True)
class CachedResponse:
"""A dataclass containing cached response information. It will mostly behave the same as a
:py:class:`aiohttp.ClientResponse` that has been read, with some additional cache-related info.
"""A dataclass containing cached response information, used for serialization.
It will mostly behave the same as a :py:class:`aiohttp.ClientResponse` that has been read,
with some additional cache-related info.
"""

method: str = attr.ib()
Expand Down

0 comments on commit 43f986a

Please sign in to comment.