try:
    last_online_times = env.db.get_last_online_since(days=days)
    logger.info('caching all last online time for {} users...'.format(len(last_online_times)))
    env.cache.set_last_online(last_online_times)
except NotImplementedError: