Class: Aerospike::LargeSet
- Defined in:
- lib/aerospike/ldt/large_set.rb
Instance Method Summary collapse
-
#add(*values) ⇒ Object
Add values to the list.
-
#exists(value) ⇒ Object
Check existence of value in the set.
-
#filter(filter_name, *filter_args) ⇒ Object
Select values from list and apply specified Lua filter.
-
#get(value) ⇒ Object
Select values from list.
-
#initialize(client, policy, key, bin_name, user_module = nil) ⇒ LargeSet
constructor
A new instance of LargeSet.
-
#remove(value) ⇒ Object
Delete value from list.
Methods inherited from Large
#capacity, #capacity=, #config, #destroy, #scan, #size
Constructor Details
#initialize(client, policy, key, bin_name, user_module = nil) ⇒ LargeSet
Returns a new instance of LargeSet.
25 26 27 28 29 30 31 |
# File 'lib/aerospike/ldt/large_set.rb', line 25 def initialize(client, policy, key, bin_name, user_module=nil) @PACKAGE_NAME = 'lset' super(client, policy, key, bin_name, user_module) self end |
Instance Method Details
#add(*values) ⇒ Object
Add values to the list. If the list does not exist, create it using specified user_module configuration.
values values to add
36 37 38 39 40 41 42 |
# File 'lib/aerospike/ldt/large_set.rb', line 36 def add(*values) if values.length == 1 @client.execute_udf(@key, @PACKAGE_NAME, 'add', [@bin_name, values[0], @user_module], @policy) else @client.execute_udf(@key, @PACKAGE_NAME, 'add_all', [@bin_name, values, @user_module], @policy) end end |
#exists(value) ⇒ Object
Check existence of value in the set.
value value to check returns true if found, otherwise false
63 64 65 |
# File 'lib/aerospike/ldt/large_set.rb', line 63 def exists(value) 1 == @client.execute_udf(@key, @PACKAGE_NAME, 'exists', [@bin_name, value], @policy) end |
#filter(filter_name, *filter_args) ⇒ Object
Select values from list and apply specified Lua filter.
filter_name Lua function name which applies filter to returned list filter_args arguments to Lua function name returns list of entries selected
72 73 74 |
# File 'lib/aerospike/ldt/large_set.rb', line 72 def filter(filter_name, *filter_args) @client.execute_udf(@key, @PACKAGE_NAME, 'filter', [@bin_name, @user_module, filter_name, filter_args], @policy) end |
#get(value) ⇒ Object
Select values from list.
value value to select returns list of entries selected
55 56 57 |
# File 'lib/aerospike/ldt/large_set.rb', line 55 def get(value) @client.execute_udf(@key, @PACKAGE_NAME, 'get', [@bin_name, value], @policy) end |
#remove(value) ⇒ Object
Delete value from list.
value value to delete
47 48 49 |
# File 'lib/aerospike/ldt/large_set.rb', line 47 def remove(value) @client.execute_udf(@key, @PACKAGE_NAME, 'remove', [@bin_name, value], @policy) end |