module Legion::Data

Constants

VERSION

Public Class Methods

connection() click to toggle source
# File lib/legion/data.rb, line 33
def connection
  Legion::Data::Connection.sequel
end
connection_setup() click to toggle source
# File lib/legion/data.rb, line 19
def connection_setup
  return if Legion::Settings[:data][:connected]

  Legion::Data::Connection.setup
end
load_models() click to toggle source
# File lib/legion/data.rb, line 29
def load_models
  Legion::Data::Models.load
end
migrate() click to toggle source
# File lib/legion/data.rb, line 25
def migrate
  Legion::Data::Migration.migrate
end
setup() click to toggle source
# File lib/legion/data.rb, line 12
def setup
  connection_setup
  migrate
  load_models
  setup_cache
end
setup_cache() click to toggle source
# File lib/legion/data.rb, line 37
def setup_cache
  return if Legion::Settings[:data][:cache][:enabled]

  return unless defined?(::Legion::Cache)

  # Legion::Data::Model::Relationship.plugin :caching, Legion::Cache, ttl: 10
  # Legion::Data::Model::Runner.plugin :caching, Legion::Cache, ttl: 60
  # Legion::Data::Model::Chain.plugin :caching, Legion::Cache, ttl: 60
  # Legion::Data::Model::Function.plugin :caching, Legion::Cache, ttl: 120
  # Legion::Data::Model::Extension.plugin :caching, Legion::Cache, ttl: 120
  # Legion::Data::Model::Node.plugin :caching, Legion::Cache, ttl: 10
  # Legion::Data::Model::TaskLog.plugin :caching, Legion::Cache, ttl: 12
  # Legion::Data::Model::Task.plugin :caching, Legion::Cache, ttl: 10
  # Legion::Data::Model::User.plugin :caching, Legion::Cache, ttl: 120
  # Legion::Data::Model::Group.plugin :caching, Legion::Cache, ttl: 120
  # Legion::Logging.info 'Legion::Data connected to Legion::Cache'
end
shutdown() click to toggle source
# File lib/legion/data.rb, line 55
def shutdown
  Legion::Data::Connection.shutdown
end