How to use the memorious.core.conn function in memorious

To help you get started, we’ve selected a few memorious examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github alephdata / memorious / memorious / logic / rate_limit.py View on Github external
def get_rate_limit(resource, limit=100, interval=60, unit=1):
    return RateLimit(conn, resource, limit=limit, interval=interval, unit=unit)
github alephdata / memorious / memorious / model / crawl.py View on Github external
def flush(cls, crawler):
        for stage in crawler.stages:
            conn.delete(make_key(crawler, stage))

        for run_id in cls.run_ids(crawler):
            conn.delete(make_key(crawler, run_id))
            conn.delete(make_key(crawler, run_id, "start"))
            conn.delete(make_key(crawler, run_id, "end"))
            conn.delete(make_key(crawler, run_id, "total_ops"))

        conn.delete(make_key(crawler, "runs"))
        conn.delete(make_key(crawler, "current_run"))
        conn.delete(make_key(crawler, "total_ops"))
        conn.delete(make_key(crawler, "last_run"))
        conn.delete(make_key(crawler, "runs_abort"))
github alephdata / memorious / memorious / worker.py View on Github external
def get_worker():
    return MemoriousWorker(conn=conn)
github alephdata / memorious / memorious / model / event.py View on Github external
def event_list(cls, key, start, end):
        results = []
        events = conn.lrange(key, start, end)
        if events is None:
            return results
        for event in events:
            result = load_json(event)
            result["timestamp"] = unpack_datetime(result['timestamp'])
            results.append(result)
        return results