def _insert_data(self, name, value, timestamp, interval, config, pipe, ttl_batch=None):
    # Calculate the TTL and abort if inserting into the past
    expire, ttl = config['expire'], config['ttl'](timestamp)
    if expire and not ttl:
      return

    i_bucket, r_bucket, i_key, r_key = self._calc_keys(config, name, timestamp)

    if config['coarse']:
      self._type_insert(pipe, i_key, value)
    else:
      # Add the resolution bucket to the interval. This allows us to easily
      # discover the resolution intervals within the larger interval, and
      # if there is a cap on the number of steps, it will go out of scope
      # along with the rest of the data
      pipe.sadd(i_key, r_bucket)
      self._type_insert(pipe, r_key, value)

    if expire:
      ttl_args = (i_key, ttl)
      if ttl_batch is not None:
        ttl_batch.add(ttl_args)
      else:
        pipe.expire(*ttl_args)
      if not config['coarse']:
        ttl_args = (r_key, ttl)
        if ttl_batch is not None:
          ttl_batch.add(ttl_args)
        else:
          pipe.expire(*ttl_args)
Helper to insert data into redis
dataset/ETHPy150Open agoragames/kairos/kairos/redis_backend.py/RedisBackend._insert_data