
Security News
Open Source Maintainers Demand Ability to Block Copilot-Generated Issues and PRs
Open source maintainers are urging GitHub to let them block Copilot from submitting AI-generated issues and pull requests to their repositories.
redis-client-extensions
Advanced tools
A set of useful core extensions to the redis-rb client library, extracted from KnowMyRankings.
Add this line to your application's Gemfile:
gem 'redis-client-extensions'
And then execute:
$ bundle
Or install it yourself as:
$ gem install redis-client-extensions
The extensions will add themselves to the Redis client automatically - in our Rails app, we have an initializer that looks something like
require 'redis-client-extensions'
$redis = Redis.new(...)
The extensions also work with MockRedis out of the box if it is installed.
Note that the library is coded against Ruby 2.1+.
Currently added functions are:
hmultiset(hkey, hash)
- convenience method for storing a Ruby hash into a redis hash$redis.hmultiset("my-hash", { name: "tom", color: "red" })
$redis.hget("my-hash", "name") # => "tom"
$redis.hget("my-hash", "color") # => "red"
find_keys_in_batches(options)
- A wrapper for SCAN to iterate over keys matching a pattern.
Options are passed through to SCAN.$redis.find_keys_in_batches(match: "mypattern*", count: 100) do |keys|
puts "Got batch of #{keys.count} keys"
puts "Values for this batch: #{$redis.mget(keys)}"
end
get_i(key)
- Parse an Integer stored at a key$redis.get_i('price') # => 9
cache_fetch(key, expires_in:, &block)
- Get or set a value (to be stored with Marshal) expiring in some number of seconds# Initial cache miss, block evaluated to store value
ret = $redis.cache_fetch('my-key', expires_in: 60) do
'cached-value'
end
# => 'cached-value'
#
# Calling again retrieves cached value, block will not be called
ret = $redis.cache_fetch('my-key', expires_in: 60) do
'something-else' # Not called!
end
# => 'cached-value'
mdump(key, val)
- Serialize and store a value at key
using Marshal$redis.mdump('my-key', [1,2,3]) # => 'OK'
mload(key)
- Retrieve a Marshalled value from key
$redis.mdump('my-key', [1,2,3])
$redis.mload('my-key') # => [1,2,3]
$redis.mload('does-not-exist') # => nil
git checkout -b my-new-feature
)git commit -am 'Add some feature'
)git push origin my-new-feature
)FAQs
Unknown package
We found that redis-client-extensions demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Open source maintainers are urging GitHub to let them block Copilot from submitting AI-generated issues and pull requests to their repositories.
Research
Security News
Malicious Koishi plugin silently exfiltrates messages with hex strings to a hardcoded QQ account, exposing secrets in chatbots across platforms.
Research
Security News
Malicious PyPI checkers validate stolen emails against TikTok and Instagram APIs, enabling targeted account attacks and dark web credential sales.