Allow the HTTP cache to be disabled or created in any location
Review Request #7293 — Created May 8, 2015 and submitted
The HTTP cache for the API can now be disabled via the
--disable-caching
command line argument. It can also be moved to an
arbitrary location with--cache-location FILE
or created in memory
with--in-memory-cache
. This behaviour is also available to consumers
of the API via theRBClient
. Theallow_caching
,cache_location
,
andin_memory_cache
key word arguments can be used for this.
Unit tests passed.
Ran the following commands:
rbt status --debug --disable-cache
rbt status --debug --in-memory-cache
rbt status --debug --cache-location /tmp/cache
The debugging information indicated the correct behaviour was taking
place in each instance.
Description | From | Last Updated |
---|---|---|
Col: 1 W391 blank line at end of file |
reviewbot | |
Because of the magic of kwargs, you can just do: self._cache = APICache(create_db_in_memory=in_memory, db_location=cache_location) |
david | |
Blank line between these. |
chipx86 | |
This can be: self.cache_path = db_location or self.DEFAULT_CACHE_PATH |
chipx86 | |
We should probably add config options for these as well. |
chipx86 | |
Missing a trailing period. |
chipx86 | |
It's going to delete whichever one is specified, right? |
chipx86 |
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 2 (+106 -43) |
-
Tool: Pyflakes Processed Files: rbtools/api/transport/__init__.py rbtools/commands/__init__.py rbtools/commands/clearcache.py rbtools/api/transport/sync.py rbtools/api/cache.py rbtools/api/request.py Tool: PEP8 Style Checker Processed Files: rbtools/api/transport/__init__.py rbtools/commands/__init__.py rbtools/commands/clearcache.py rbtools/api/transport/sync.py rbtools/api/cache.py rbtools/api/request.py
-
-
rbtools/api/request.py (Diff revision 2) Because of the magic of kwargs, you can just do:
self._cache = APICache(create_db_in_memory=in_memory, db_location=cache_location)
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 3 (+104 -43) |
-
Tool: Pyflakes Processed Files: rbtools/api/transport/__init__.py rbtools/commands/__init__.py rbtools/commands/clearcache.py rbtools/api/transport/sync.py rbtools/api/cache.py rbtools/api/request.py Tool: PEP8 Style Checker Processed Files: rbtools/api/transport/__init__.py rbtools/commands/__init__.py rbtools/commands/clearcache.py rbtools/api/transport/sync.py rbtools/api/cache.py rbtools/api/request.py
-
-
-
rbtools/api/cache.py (Diff revision 3) This can be:
self.cache_path = db_location or self.DEFAULT_CACHE_PATH
-
rbtools/commands/__init__.py (Diff revision 3) We should probably add config options for these as well.
-
-
rbtools/commands/clearcache.py (Diff revision 3) It's going to delete whichever one is specified, right?
Change Summary:
Address Christian's issues.
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 4 (+116 -45) |
-
Tool: Pyflakes Processed Files: rbtools/api/transport/__init__.py rbtools/commands/__init__.py rbtools/commands/clearcache.py rbtools/api/transport/sync.py rbtools/api/cache.py rbtools/api/request.py Tool: PEP8 Style Checker Processed Files: rbtools/api/transport/__init__.py rbtools/commands/__init__.py rbtools/commands/clearcache.py rbtools/api/transport/sync.py rbtools/api/cache.py rbtools/api/request.py