<commit_before>package redis

import (
	"time"

	"github.com/garyburd/redigo/redis"
)

type Redis struct {
	pool *redis.Pool
}

func New(host, port string) Redis {
	dsn := host + ":" + port

	return Redis{
		pool: &redis.Pool{
			MaxIdle:     3,
			IdleTimeout: 240 * time.Second,
			Dial: func() (redis.Conn, error) {
				c, err := redis.Dial("tcp", dsn)
				if err != nil {
					return nil, err
				}

				return c, nil
			},
		},
	}
}

func (r Redis) Get(key string) []byte {
	client := r.pool.Get()
	defer client.Close()

	data, _ := redis.Bytes(client.Do("GET", key))

	return data
}

func (r Redis) Put(key string, data []byte) error {
	client := r.pool.Get()
	defer client.Close()

	_, err := client.Do("SET", key, data)

	return err
}

func (r Redis) Delete(key string) {
	// ToDo: implement
}

func (r Redis) Flush() {
	client := r.pool.Get()
	defer client.Close()

	client.Do("FLUSHDB")
}<commit_msg>missing delete implementation<commit_after>package redis

import (
	"time"

	"github.com/garyburd/redigo/redis"
)

type Redis struct {
	pool *redis.Pool
}

func New(host, port string) Redis {
	dsn := host + ":" + port

	return Redis{
		pool: &redis.Pool{
			MaxIdle:     3,
			IdleTimeout: 240 * time.Second,
			Dial: func() (redis.Conn, error) {
				c, err := redis.Dial("tcp", dsn)
				if err != nil {
					return nil, err
				}

				return c, nil
			},
		},
	}
}

func (r Redis) Get(key string) []byte {
	client := r.pool.Get()
	defer client.Close()

	data, _ := redis.Bytes(client.Do("GET", key))

	return data
}

func (r Redis) Put(key string, data []byte) error {
	client := r.pool.Get()
	defer client.Close()

	_, err := client.Do("SET", key, data)

	return err
}

func (r Redis) Delete(key string) {
	client := r.pool.Get()
	defer client.Close()

	client.Do("DEL", key)
}

func (r Redis) Flush() {
	client := r.pool.Get()
	defer client.Close()

	client.Do("FLUSHDB")
}
{'fraction_non_alphanumeric': 0.16967126193001061, 'fraction_numerical': 0.0042417815482502655, 'mean_word_length': 3.0844155844155843, 'pattern_counts': {'":': 2, '<': 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': '6781118', 'n_tokens_mistral': 825, 'n_tokens_neox': 745, 'n_words': 192}