<commit_before>import logging
from campaign.storage.sql import Storage as SqlStorage
# Requires umemcache installed
from mozsvc.storage.mcclient import MemcachedClient


class Storage(SqlStorage):

    def __init__(self, config, **kw):
        try:
            super(Storage, self).__init__(config, **kw)
            self.memcache = MemcachedClient(
                servers=self.settings.get('db.memcache_servers'),
                key_prefix='cm_')
            self.expry = int(self.settings.get('db.query_window'))
        except Exception, e:
            logging.error('Could not initialize Storage "%s"', str(e))
            raise e

    def health_check(self):
        healthy = super(Storage, self).health_check()
        # TODO: MemCache health check
        return healthy

    def resolve(self, token):
        if token is None:
            return None
        record = self.memcache.get(token)
        if record is None:
            record = super(Storage, self).resolve(token)
        return record
<commit_msg>set default db.window to 300<commit_after>import logging
from campaign.storage.sql import Storage as SqlStorage
# Requires umemcache installed
from mozsvc.storage.mcclient import MemcachedClient


class Storage(SqlStorage):

    def __init__(self, config, **kw):
        try:
            super(Storage, self).__init__(config, **kw)
            self.memcache = MemcachedClient(
                servers=self.settings.get('db.memcache_servers'),
                key_prefix='cm_')
            self.expry = int(self.settings.get('db.query_window', 300))
        except Exception, e:
            logging.error('Could not initialize Storage "%s"', str(e))
            raise e

    def health_check(self):
        healthy = super(Storage, self).health_check()
        # TODO: MemCache health check
        return healthy

    def resolve(self, token):
        if token is None:
            return None
        record = self.memcache.get(token)
        if record is None:
            record = super(Storage, self).resolve(token)
        return record

{'fraction_non_alphanumeric': 0.09593023255813954, 'fraction_numerical': 0.0029069767441860465, 'mean_word_length': 2.368678629690049, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7368899', 'n_tokens_mistral': 563, 'n_tokens_neox': 548, 'n_words': 151}