<commit_before># Keytar

TODO: Write a gem description

## Installation

Add this line to your application's Gemfile:

    gem 'keytar'

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install keytar

## Usage

TODO: Write usage instructions here

## Contributing

1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request


keytar gem

create redis namespaces to cache key lists and have invalidation methods

ex: 

keytar_redis REDIS
keytar_namespace 'api:articles'
keytar_ttl 30.days

keytar.set id, Article.create

# which will execute: 
	# key = namespace+":"+key
	# REDIS.set key, value
	# REDIS.sadd namespace+":keys", key
	# REDIS.expire key, ttl

# later we can say in the controller

keytar.clear
# which will execute
	# keys = REDIS.smembers namespace+":keys"
	# keys.each do |key|
	#   REDIS.del key
	# end
<commit_msg>Readme update<commit_after># Keytar

TODO: Write a gem description

## Installation

Add this line to your application's Gemfile:

    gem 'keytar'

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install keytar

## Usage

TODO: Write usage instructions here

## Contributing

1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request


keytar gem

create redis namespaces to cache key lists and have invalidation methods

ex: 

```ruby
  keytar_redis REDIS
	keytar_namespace 'api:articles'
	keytar_ttl 30.days

	keytar.set id, Article.create
```

# which will execute: 
```ruby
	key = namespace+":"+key
	REDIS.set key, value
	REDIS.sadd namespace+":keys", key
	REDIS.expire key, ttl
```

# later we can say in the controller
```ruby
keytar.clear
```
# which will execute
```ruby
	keys = REDIS.smembers namespace+":keys"
	keys.each do |key|
	  REDIS.del key
	end
```
{'fraction_non_alphanumeric': 0.09666505558240696, 'fraction_numerical': 0.006766553890768487, 'mean_word_length': 3.8027842227378192, 'pattern_counts': {'":': 6, '<': 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': '1806686', 'n_tokens_mistral': 732, 'n_tokens_neox': 697, 'n_words': 263}