
Security News
New Website “Is It Really FOSS?” Tracks Transparency in Open Source Distribution Models
A new site reviews software projects to reveal if they’re truly FOSS, making complex licensing and distribution models easy to understand.
Include Carpenter::Model
to your class and define any params and fields you need.
class Example
include Carpenter::Model
param :id
field :first, :integer
field :second
end
After this, you can get and set values in redis via the model.
Example[1].first # => nil
Example[1].first = 10
Example[1].first # => 10
Example[2].first # => nil
field
can be one of:
When defining field
you can pass some options:
class Example
include Carpenter::Model
param :id
field :first, :integer, default: 100
field :second
end
Example[1].first # => 100
Example[1].first = 10
Example[1].first # => 10
Example[2].first # => 100
class Example
include Carpenter::Model
param :id
field :first, :integer, store: true
field :second
end
ex = Example[1]
ex.first # => nil
ex.first = 10
ex.first # => 10
ex.first = 20
ex.first # => 10
ex.first.reload
ex.first # => 20
class Example
include Carpenter::Model
param :id
param :id2
field :first
field :second
end
[:id, :id2]
Example
with params stab like Example-{id}-{id2}
[:first, :second]
. They contain class key and look like Example-{id}-{id2}:first
Example[id: 1, id2: 5]
{ id: 1, id2: 5 }
Example-1-5
[:first, :second]
) with updated keys: Example-1-5:first
Example[id2: 10] #=> This creates key like "Example-@-10"
@
Example[1, 5] #=> "Example-1-5"
# OR
Example[nil, 10] #=> "Example-@-10"
# OR
Example[8] #=> "Example-8-@"
redis_list
examples
class Example
include Carpenter::Model
param :id
field :redis_list, :redis_list
end
Example[1].redis_list #=> []
Example[1].redis_list.get #=> []
Example[1].redis_list = [1, 2, 3]
Example[1].redis_list.get #=> [1, 2, 3]
Example[1].redis_list[1] #=> 2
Example[1].redis_list[1..2] #=> [2, 3]
Example[1].redis_list[1...2] #=> [2]
Example[1].redis_list[1] = 10
Example[1].redis_list.get #=> [1, 10, 3]
Example[1].redis_list << 200
Example[1].redis_list.get #=> [1, 10, 3, 200]
Example[1].redis_list << { email: 'example@mail.ru' }
Example[1].redis_list.get #=> [1, 10, 3, 200, { email: 'example@mail.ru' }]
FAQs
Unknown package
We found that redis-carpenter demonstrated a healthy version release cadence and project activity because the last version was released less than 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
A new site reviews software projects to reveal if they’re truly FOSS, making complex licensing and distribution models easy to understand.
Security News
Astral unveils pyx, a Python-native package registry in beta, designed to speed installs, enhance security, and integrate deeply with uv.
Security News
The Latio podcast explores how static and runtime reachability help teams prioritize exploitable vulnerabilities and streamline AppSec workflows.