activerecord_idnamecache 0.0.4 → 0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -3,7 +3,7 @@ activerecord_idnamecache
3
3
  Use Mysql AUTO_INCREMENT to support key value cache, which should be combined by an integer and string.
4
4
  It means to reduce the database storage size, and improve query performance.
5
5
 
6
- All cache will store in process memory, and will never be expired, until the process dies, so the less kvs you use, the better performance you will get. BTW, 100,0000 general strings use 10MB memory.
6
+ All cache will store in process memory, and will never be expired, until the process dies, so the less kvs you use, the better performance you will get. BTW, 100,000 general strings use 10MB memory.
7
7
 
8
8
  Some relatived articles:
9
9
  http://en.wikipedia.org/wiki/Correlation_database
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.4
1
+ 0.1
@@ -1,8 +1,8 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'activerecord_idnamecache'
3
3
  s.version = File.read("VERSION").strip
4
- s.date = '2013-06-22'
5
- s.summary = File.read("README.markdown").split(/===+/)[0].strip
4
+ s.date = '2013-06-30'
5
+ s.summary = File.read("README.markdown").split(/===+/)[1].strip
6
6
  s.description = s.summary
7
7
  s.authors = ["David Chen"]
8
8
  s.email = 'mvjome@gmail.com'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord_idnamecache
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: '0.1'
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,9 +9,27 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-06-22 00:00:00.000000000 Z
12
+ date: 2013-06-30 00:00:00.000000000 Z
13
13
  dependencies: []
14
- description: activerecord_idnamecache
14
+ description: ! 'Use Mysql AUTO_INCREMENT to support key value cache, which should
15
+ be combined by an integer and string. It means to reduce the database storage size,
16
+ and improve query performance. All cache will store in process memory, and will
17
+ never be expired, until the process dies, so the less kvs you use, the better performance
18
+ you will get. BTW, 100,000 general strings use 10MB memory. Some relatived articles:
19
+ http://en.wikipedia.org/wiki/Correlation_database Usage ------------------------------------------
20
+ ## setup ```ruby create_table :kv_browser_names, :options => ''ENGINE=MyISAM DEFAULT
21
+ CHARSET=utf8'' do |t| t.string :name t.timestamps end class KvBrowserName < ActiveRecord::Base
22
+ include IdNameCache end ``` or ```ruby create_table :common_tag, :options => ''ENGINE=MyISAM
23
+ DEFAULT CHARSET=utf8'' do |t| t.integer :tagid t.string :tagname end class CommonTag
24
+ < ActiveRecord::Base self.table_name = :common_tag self.primary_key = :tagid include
25
+ IdNameCache; set_key_value :tagid, :tagname # include IdNameCache; set_key_value_without_create
26
+ :tagid, :tagname # if you dont want create it automately end ``` ### use cases ```text
27
+ ruby-1.9.3-rc1 :001 > QuizTag[1] QuizTag Load (0.3ms) SELECT `common_tag`.* FROM
28
+ `common_tag` WHERE `common_tag`.`tagid` = 1 LIMIT 1 => "Android" ruby-1.9.3-rc1
29
+ :002 > QuizTag[1] => "Android" ruby-1.9.3-rc1 :003 > QuizTag[''Android''] QuizTag
30
+ Load (0.5ms) SELECT `common_tag`.* FROM `common_tag` WHERE `common_tag`.`tagname`
31
+ = ''Android'' LIMIT 1 => 1 ruby-1.9.3-rc1 :004 > QuizTag[''Android''] => 1 ``` ==
32
+ Copyright MIT, David Chen at eoe.cn'
15
33
  email: mvjome@gmail.com
16
34
  executables: []
17
35
  extensions: []
@@ -50,5 +68,23 @@ rubyforge_project:
50
68
  rubygems_version: 1.8.25
51
69
  signing_key:
52
70
  specification_version: 3
53
- summary: activerecord_idnamecache
71
+ summary: ! 'Use Mysql AUTO_INCREMENT to support key value cache, which should be combined
72
+ by an integer and string. It means to reduce the database storage size, and improve
73
+ query performance. All cache will store in process memory, and will never be expired,
74
+ until the process dies, so the less kvs you use, the better performance you will
75
+ get. BTW, 100,000 general strings use 10MB memory. Some relatived articles: http://en.wikipedia.org/wiki/Correlation_database Usage
76
+ ------------------------------------------ ## setup ```ruby create_table :kv_browser_names,
77
+ :options => ''ENGINE=MyISAM DEFAULT CHARSET=utf8'' do |t| t.string :name t.timestamps
78
+ end class KvBrowserName < ActiveRecord::Base include IdNameCache end ``` or ```ruby
79
+ create_table :common_tag, :options => ''ENGINE=MyISAM DEFAULT CHARSET=utf8'' do
80
+ |t| t.integer :tagid t.string :tagname end class CommonTag < ActiveRecord::Base
81
+ self.table_name = :common_tag self.primary_key = :tagid include IdNameCache; set_key_value
82
+ :tagid, :tagname # include IdNameCache; set_key_value_without_create :tagid, :tagname
83
+ # if you dont want create it automately end ``` ### use cases ```text ruby-1.9.3-rc1
84
+ :001 > QuizTag[1] QuizTag Load (0.3ms) SELECT `common_tag`.* FROM `common_tag`
85
+ WHERE `common_tag`.`tagid` = 1 LIMIT 1 => "Android" ruby-1.9.3-rc1 :002 > QuizTag[1]
86
+ => "Android" ruby-1.9.3-rc1 :003 > QuizTag[''Android''] QuizTag Load (0.5ms) SELECT
87
+ `common_tag`.* FROM `common_tag` WHERE `common_tag`.`tagname` = ''Android'' LIMIT
88
+ 1 => 1 ruby-1.9.3-rc1 :004 > QuizTag[''Android''] => 1 ``` == Copyright MIT, David
89
+ Chen at eoe.cn'
54
90
  test_files: []