Permalink
Browse files

* initial memcached support.

  • Loading branch information...
1 parent 1ebd094 commit 24f2a78bbcab045cc6026c75c1a78803c874670d @spejman committed Apr 16, 2008
Showing with 9 additions and 1 deletion.
  1. +2 −1 app/controllers/meta_querier_controller.rb
  2. +6 −0 lib/infer_db_model.rb
  3. +1 −0 lib/meta_rails_common.rb
@@ -19,7 +19,8 @@ class MetaQuerierController < MetaQuerierControllersCommon
before_filter :load_db_data, :only => [:edit]
# ACTIONS
def index
- redirect_to :action => "list"
+ list
+ render :action => "list"
end
def list
View
@@ -25,6 +25,11 @@ module InferDbModel
# }
def klass_struct(excluded_tables = [], excluded_columns = [])
+ begin
+ cache = Memcached.new("127.0.0.1:11211")
+ return cache.get("klass_struct")
+ rescue
+ end
ar_db_no_relevant_columns = ["id"] + []
@@ -57,6 +62,7 @@ def klass_struct(excluded_tables = [], excluded_columns = [])
klasses[klass_name] = { "class_attr" => activerecord_columns[klass_name] }
klasses[klass_name]["class_ass"] = activerecord_associations[klass_name].collect {|rel_value, rel_type| {rel_type => rel_value.to_s}}
end
+ cache.set("klass_struct", klasses)
return klasses
end
View
@@ -1,4 +1,5 @@
require File.join(File.dirname(__FILE__), "infer_db_model.rb")
+require 'memcached'
module MetaRails

0 comments on commit 24f2a78

Please sign in to comment.