Class: Backup::Database::Redis
- Defined in:
- lib/backup/database/redis.rb
Constant Summary
Constants included from CLI::Helpers
Instance Attribute Summary collapse
-
#additional_options ⇒ Object
Additional “redis-cli” options.
-
#host ⇒ Object
Connectivity options.
-
#invoke_save ⇒ Object
Determines whether Backup should invoke the SAVE command through the ‘redis-cli’ utility to persist the most recent data before copying over the dump file.
-
#name ⇒ Object
Name of and path to the database that needs to get dumped.
-
#password ⇒ Object
Credentials for the specified database.
-
#path ⇒ Object
Name of and path to the database that needs to get dumped.
-
#port ⇒ Object
Connectivity options.
-
#redis_cli_utility ⇒ Object
Path to the redis-cli utility (optional).
-
#socket ⇒ Object
Connectivity options.
Instance Method Summary collapse
-
#initialize(model, &block) ⇒ Redis
constructor
Creates a new instance of the Redis database object.
-
#perform! ⇒ Object
Performs the Redis backup by using the ‘cp’ unix utility to copy the persisted Redis dump file to the Backup archive.
Methods included from Configuration::Helpers
Constructor Details
#initialize(model, &block) ⇒ Redis
Creates a new instance of the Redis database object
39 40 41 42 43 44 45 46 47 48 |
# File 'lib/backup/database/redis.rb', line 39 def initialize(model, &block) super(model) @additional_options ||= Array.new instance_eval(&block) if block_given? @name ||= 'dump' @redis_cli_utility ||= utility('redis-cli') end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Backup::Configuration::Helpers
Instance Attribute Details
#additional_options ⇒ Object
Additional “redis-cli” options
27 28 29 |
# File 'lib/backup/database/redis.rb', line 27 def @additional_options end |
#host ⇒ Object
Connectivity options
17 18 19 |
# File 'lib/backup/database/redis.rb', line 17 def host @host end |
#invoke_save ⇒ Object
Determines whether Backup should invoke the SAVE command through the ‘redis-cli’ utility to persist the most recent data before copying over the dump file
23 24 25 |
# File 'lib/backup/database/redis.rb', line 23 def invoke_save @invoke_save end |
#name ⇒ Object
Name of and path to the database that needs to get dumped
9 10 11 |
# File 'lib/backup/database/redis.rb', line 9 def name @name end |
#password ⇒ Object
Credentials for the specified database
13 14 15 |
# File 'lib/backup/database/redis.rb', line 13 def password @password end |
#path ⇒ Object
Name of and path to the database that needs to get dumped
9 10 11 |
# File 'lib/backup/database/redis.rb', line 9 def path @path end |
#port ⇒ Object
Connectivity options
17 18 19 |
# File 'lib/backup/database/redis.rb', line 17 def port @port end |
#redis_cli_utility ⇒ Object
Path to the redis-cli utility (optional)
31 32 33 |
# File 'lib/backup/database/redis.rb', line 31 def redis_cli_utility @redis_cli_utility end |
#socket ⇒ Object
Connectivity options
17 18 19 |
# File 'lib/backup/database/redis.rb', line 17 def socket @socket end |
Instance Method Details
#perform! ⇒ Object
Performs the Redis backup by using the ‘cp’ unix utility to copy the persisted Redis dump file to the Backup archive. Additionally, when ‘invoke_save’ is set to true, it’ll tell the Redis server to persist the current state to the dump file before copying the dump to get the most recent updates in to the backup
56 57 58 59 60 61 |
# File 'lib/backup/database/redis.rb', line 56 def perform! super invoke_save! if invoke_save copy! end |