Changeset ad5df3a in rattail


Ignore:
Timestamp:
08/01/2022 09:12:25 PM (6 months ago)
Author:
Lance Edgar <lance@…>
Branches:
master
Children:
d006a6d
Parents:
0ce1f4a
Message:

Remove "basic db cache" for config from DB settings table

turns out that won't even work right

refs #8

File:
1 edited

Legend:

Unmodified
Added
Removed
  • rattail/config.py

    r0ce1f4a rad5df3a  
    143143        self.versioning_has_been_enabled = False
    144144
    145         # implement a basic db caching mechanism, if configured
    146         self.basic_db_cache = self.getbool('rattail.config',
    147                                            'basic_db_cache',
    148                                            default=False,
    149                                            usedb=False)
    150         if self.basic_db_cache:
    151             self.cache_expiry_seconds = 30
    152             self.cached_settings = {}
    153 
    154145    def read_file(self, path, recurse=True, require=False):
    155146        """
     
    308299        now = app.localtime(tzinfo=False)
    309300
    310         # first try to return value from simple cache
    311         if self.basic_db_cache:
    312             cached = self.cached_settings.get(name)
    313             if cached:
    314                 time, value = cached
    315                 if (now - time).total_seconds() <= self.cache_expiry_seconds:
    316                     return value
    317 
    318301        close = False
    319302        if not session:
     
    326309        if close:
    327310            session.close()
    328 
    329         # add value to simple cache
    330         if self.basic_db_cache:
    331             self.cached_settings[name] = (now, value)
    332311
    333312        return value
Note: See TracChangeset for help on using the changeset viewer.