lib/legion/data.rb in legion-data-0.2.0 vs lib/legion/data.rb in legion-data-1.1.2

- old
+ new

@@ -1,21 +1,21 @@ require 'legion/data/version' -require_relative 'data/settings' +require 'legion/data/settings' require 'sequel' -require_relative 'data/connection' -require_relative 'data/model' -require_relative 'data/migration' +require 'legion/data/connection' +require 'legion/data/model' +require 'legion/data/migration' module Legion module Data class << self def setup connection_setup migrate load_models - # setup_cache + setup_cache end def connection_setup return if Legion::Settings[:data][:connected] @@ -32,23 +32,20 @@ def connection Legion::Data::Connection.sequel end - def setup_cache # rubocop:disable Metrics/AbcSize - return if Legion::Settings[:data][:cache][:enable] + def setup_cache + return if Legion::Settings[:data][:cache][:enabled] - unless Legion::Settings[:cache][:connected] - Legion::Logging.warn 'Legion::Data has caching enabled but Legion::Cache is not started' - end - return unless Legion::Settings[:cache][:connected] + return unless defined?(::Legion::Cache) - # Legion::Data::Model::Relationship.plugin :caching, Legion::Cache, ttl: 10 + Legion::Data::Model::Relationship.plugin :caching, Legion::Cache, ttl: 10 Legion::Data::Model::Chain.plugin :caching, Legion::Cache, ttl: 60 Legion::Data::Model::Datacenter.plugin :caching, Legion::Cache, ttl: 120 Legion::Data::Model::Extension.plugin :caching, Legion::Cache, ttl: 120 Legion::Data::Model::Function.plugin :caching, Legion::Cache, ttl: 120 - Legion::Data::Model::Namespace.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