<commit_before>package cache

import (
	"context"
	"sync"
	"time"
)

type memCache struct {
	opts Options
	sync.RWMutex
	ctx context.Context

	items map[string]Item
}

func (c *memCache) Context(ctx context.Context) Cache {
	c.ctx = ctx
	return c
}

func (c *memCache) Get(key string) (interface{}, time.Time, error) {
	c.RWMutex.Lock()
	defer c.RWMutex.Unlock()
<commit_msg>use read lock and unlock instead of write ones (#2410)<commit_after>package cache

import (
	"context"
	"sync"
	"time"
)

type memCache struct {
	opts Options
	sync.RWMutex
	ctx context.Context

	items map[string]Item
}

func (c *memCache) Context(ctx context.Context) Cache {
	c.ctx = ctx
	return c
}

func (c *memCache) Get(key string) (interface{}, time.Time, error) {
	c.RWMutex.RLock()
	defer c.RWMutex.RUnlock()

{'fraction_non_alphanumeric': 0.12484237074401008, 'fraction_numerical': 0.005044136191677175, 'mean_word_length': 4.293333333333333, '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': '2831355', 'n_tokens_mistral': 298, 'n_tokens_neox': 303, 'n_words': 83}