Limit cache location to be in memory or in a default location.

Review Request #6648 — Created Nov. 26, 2014 and submitted

brennie
RBTools
master
d3a15bc...
rbtools, students

The HTTP cache for the API now takes a parameter that determines if it
is created in memory (create_db_in_memory). This parameter replaces
the db_path parameter, which previously accepted the special value
':memory:' to create the SQLite database in memory. The new
parameter is more straightforward because caches will only ever be
required to be created at the default location (for normal operation)
or in memory (for unit testing).

The default API cache path is stored on the APICache class as the
CACHE_PATH constant, which can be used without instantiating the
class. Becuase the HTTP cache for the API is only ever stored in one
location on disk, it can be cleared (i.e., unlinked) without
instantiating the class to determine where it is located on disk. This
is important in the case where the cache exists but has become corrupt
and cannot be loaded (and so instantiation of the APICache class will
fail).

Unit tests pass.

  • 0
  • 0
  • 2
  • 0
  • 2
Description From Last Updated
  1. Tool: Pyflakes
    Processed Files:
        rbtools/api/tests.py
        rbtools/api/cache.py
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        rbtools/api/tests.py
        rbtools/api/cache.py
    
    
  2. 
      
chipx86
  1. 
      
  2. rbtools/api/cache.py (Diff revision 1)
     
     

    Generally, it's a bit nicer to do a 'if True, else' than a 'if not True, else', just to keep logic simple. Can we change this and move the else body up to here?

  3. 
      
brennie
  1. Tool: PEP8 Style Checker
    Processed Files:
        rbtools/api/tests.py
        rbtools/utils/filesystem.py
        rbtools/api/cache.py
    
    
    
    Tool: Pyflakes
    Processed Files:
        rbtools/api/tests.py
        rbtools/utils/filesystem.py
        rbtools/api/cache.py
    
    
  2. 
      
chipx86
  1. Looks like you have bits of the TREES/ALIASES change in here.

  2. rbtools/api/cache.py (Diff revision 2)
     
     
     
     
     

    Given that this is done in both cases, can we just move this out of the conditional?

  3. 
      
brennie
  1. Tool: Pyflakes
    Processed Files:
        rbtools/api/tests.py
        rbtools/api/cache.py
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        rbtools/api/tests.py
        rbtools/api/cache.py
    
    
  2. 
      
brennie
chipx86
  1. Commit summaries are limited to 79 characters.

  2. 
      
brennie
david
  1. Ship It!
  2. 
      
brennie
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to master (4dd199c)
Loading...