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.
Attributes inherited from Base
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
#clear_defaults!, #load_defaults!
Methods included from CLI::Helpers
#command_name, #raise_if_command_failed!, #run, #utility
Constructor Details
#initialize(model, &block) ⇒ Redis
Creates a new instance of the Redis database object
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/backup/database/redis.rb', line 35 def initialize(model, &block) super(model) @additional_options ||= Array.new instance_eval(&block) if block_given? @name ||= 'dump' if @utility_path Logger.warn "[DEPRECATED] " + "Database::Redis#utility_path has been deprecated.\n" + " Use Database::Redis#redis_cli_utility instead." @redis_cli_utility ||= @utility_path end @redis_cli_utility ||= utility('redis-cli') end |
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
23 24 25 |
# File 'lib/backup/database/redis.rb', line 23 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
19 20 21 |
# File 'lib/backup/database/redis.rb', line 19 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
23 24 25 |
# File 'lib/backup/database/redis.rb', line 23 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
23 24 25 |
# File 'lib/backup/database/redis.rb', line 23 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
59 60 61 62 63 64 |
# File 'lib/backup/database/redis.rb', line 59 def perform! super invoke_save! if invoke_save copy! end |