artemk-cache-money 0.2.13.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/LICENSE +201 -0
- data/README +210 -0
- data/README.markdown +210 -0
- data/TODO +17 -0
- data/UNSUPPORTED_FEATURES +12 -0
- data/config/environment.rb +16 -0
- data/config/memcached.yml +6 -0
- data/db/schema.rb +18 -0
- data/init.rb +1 -0
- data/lib/cache_money.rb +86 -0
- data/lib/cash/accessor.rb +83 -0
- data/lib/cash/buffered.rb +129 -0
- data/lib/cash/config.rb +82 -0
- data/lib/cash/fake.rb +83 -0
- data/lib/cash/finders.rb +38 -0
- data/lib/cash/index.rb +214 -0
- data/lib/cash/local.rb +76 -0
- data/lib/cash/lock.rb +63 -0
- data/lib/cash/mock.rb +154 -0
- data/lib/cash/query/abstract.rb +197 -0
- data/lib/cash/query/calculation.rb +45 -0
- data/lib/cash/query/primary_key.rb +50 -0
- data/lib/cash/query/select.rb +16 -0
- data/lib/cash/request.rb +3 -0
- data/lib/cash/transactional.rb +43 -0
- data/lib/cash/util/active_record.rb +5 -0
- data/lib/cash/util/array.rb +9 -0
- data/lib/cash/util/marshal.rb +19 -0
- data/lib/cash/write_through.rb +69 -0
- data/lib/mem_cached_session_store.rb +50 -0
- data/lib/mem_cached_support_store.rb +141 -0
- data/lib/memcached_wrapper.rb +261 -0
- data/spec/cash/accessor_spec.rb +186 -0
- data/spec/cash/active_record_spec.rb +224 -0
- data/spec/cash/buffered_spec.rb +9 -0
- data/spec/cash/calculations_spec.rb +67 -0
- data/spec/cash/finders_spec.rb +408 -0
- data/spec/cash/local_buffer_spec.rb +9 -0
- data/spec/cash/local_spec.rb +9 -0
- data/spec/cash/lock_spec.rb +108 -0
- data/spec/cash/marshal_spec.rb +60 -0
- data/spec/cash/order_spec.rb +172 -0
- data/spec/cash/transactional_spec.rb +578 -0
- data/spec/cash/window_spec.rb +195 -0
- data/spec/cash/write_through_spec.rb +245 -0
- data/spec/memcached_wrapper_test.rb +209 -0
- data/spec/spec_helper.rb +68 -0
- metadata +168 -0
    
        data/spec/spec_helper.rb
    ADDED
    
    | @@ -0,0 +1,68 @@ | |
| 1 | 
            +
            dir = File.dirname(__FILE__)
         | 
| 2 | 
            +
            $LOAD_PATH.unshift "#{dir}/../lib"
         | 
| 3 | 
            +
             | 
| 4 | 
            +
            require File.join(dir, '../config/environment')
         | 
| 5 | 
            +
            require 'spec'
         | 
| 6 | 
            +
            require 'pp'
         | 
| 7 | 
            +
            require 'cache_money'
         | 
| 8 | 
            +
             | 
| 9 | 
            +
            begin
         | 
| 10 | 
            +
              require 'memcached'
         | 
| 11 | 
            +
            rescue Exception => e
         | 
| 12 | 
            +
              require 'memcache'
         | 
| 13 | 
            +
            end
         | 
| 14 | 
            +
             | 
| 15 | 
            +
            require 'memcached_wrapper'
         | 
| 16 | 
            +
             | 
| 17 | 
            +
            Spec::Runner.configure do |config|
         | 
| 18 | 
            +
              config.mock_with :rr
         | 
| 19 | 
            +
              config.before :suite do
         | 
| 20 | 
            +
                load File.join(dir, "../db/schema.rb")
         | 
| 21 | 
            +
             | 
| 22 | 
            +
                config = YAML.load(IO.read((File.expand_path(File.dirname(__FILE__) + "/../config/memcached.yml"))))['test']
         | 
| 23 | 
            +
                memcache_class = defined?(MemcachedWrapper) ? MemcachedWrapper : MemCache
         | 
| 24 | 
            +
                $memcache = memcache_class.new(config["servers"].gsub(' ', '').split(','), config) 
         | 
| 25 | 
            +
                $lock = Cash::Lock.new($memcache)
         | 
| 26 | 
            +
              end
         | 
| 27 | 
            +
             | 
| 28 | 
            +
              config.before :each do
         | 
| 29 | 
            +
                $memcache.flush_all
         | 
| 30 | 
            +
                Story.delete_all
         | 
| 31 | 
            +
                Character.delete_all
         | 
| 32 | 
            +
              end
         | 
| 33 | 
            +
             | 
| 34 | 
            +
              config.before :suite do
         | 
| 35 | 
            +
                ActiveRecord::Base.class_eval do
         | 
| 36 | 
            +
                  is_cached :repository => Cash::Transactional.new($memcache, $lock)
         | 
| 37 | 
            +
                end
         | 
| 38 | 
            +
             | 
| 39 | 
            +
                Character = Class.new(ActiveRecord::Base)
         | 
| 40 | 
            +
                Story = Class.new(ActiveRecord::Base)
         | 
| 41 | 
            +
                
         | 
| 42 | 
            +
                Story.has_many :characters
         | 
| 43 | 
            +
             | 
| 44 | 
            +
                Story.class_eval do
         | 
| 45 | 
            +
                  index :title
         | 
| 46 | 
            +
                  index [:id, :title]
         | 
| 47 | 
            +
                  index :published
         | 
| 48 | 
            +
                end
         | 
| 49 | 
            +
             | 
| 50 | 
            +
                Short = Class.new(Story)
         | 
| 51 | 
            +
                Short.class_eval do
         | 
| 52 | 
            +
                  index :subtitle, :order_column => 'title'
         | 
| 53 | 
            +
                end
         | 
| 54 | 
            +
             | 
| 55 | 
            +
                Epic = Class.new(Story)
         | 
| 56 | 
            +
                Oral = Class.new(Epic)
         | 
| 57 | 
            +
             | 
| 58 | 
            +
                Character.class_eval do
         | 
| 59 | 
            +
                  index [:name, :story_id]
         | 
| 60 | 
            +
                  index [:id, :story_id]
         | 
| 61 | 
            +
                  index [:id, :name, :story_id]
         | 
| 62 | 
            +
                end
         | 
| 63 | 
            +
             | 
| 64 | 
            +
                Oral.class_eval do
         | 
| 65 | 
            +
                  index :subtitle
         | 
| 66 | 
            +
                end
         | 
| 67 | 
            +
              end
         | 
| 68 | 
            +
            end
         | 
    
        metadata
    ADDED
    
    | @@ -0,0 +1,168 @@ | |
| 1 | 
            +
            --- !ruby/object:Gem::Specification 
         | 
| 2 | 
            +
            name: artemk-cache-money
         | 
| 3 | 
            +
            version: !ruby/object:Gem::Version 
         | 
| 4 | 
            +
              hash: 111
         | 
| 5 | 
            +
              prerelease: false
         | 
| 6 | 
            +
              segments: 
         | 
| 7 | 
            +
              - 0
         | 
| 8 | 
            +
              - 2
         | 
| 9 | 
            +
              - 13
         | 
| 10 | 
            +
              - 2
         | 
| 11 | 
            +
              version: 0.2.13.2
         | 
| 12 | 
            +
            platform: ruby
         | 
| 13 | 
            +
            authors: 
         | 
| 14 | 
            +
            - Nick Kallen
         | 
| 15 | 
            +
            - Ashley Martens
         | 
| 16 | 
            +
            - Scott Mace
         | 
| 17 | 
            +
            - John Markos
         | 
| 18 | 
            +
            autorequire: 
         | 
| 19 | 
            +
            bindir: bin
         | 
| 20 | 
            +
            cert_chain: []
         | 
| 21 | 
            +
             | 
| 22 | 
            +
            date: 2010-09-17 00:00:00 +03:00
         | 
| 23 | 
            +
            default_executable: 
         | 
| 24 | 
            +
            dependencies: 
         | 
| 25 | 
            +
            - !ruby/object:Gem::Dependency 
         | 
| 26 | 
            +
              requirement: &id001 !ruby/object:Gem::Requirement 
         | 
| 27 | 
            +
                none: false
         | 
| 28 | 
            +
                requirements: 
         | 
| 29 | 
            +
                - - ">="
         | 
| 30 | 
            +
                  - !ruby/object:Gem::Version 
         | 
| 31 | 
            +
                    hash: 7
         | 
| 32 | 
            +
                    segments: 
         | 
| 33 | 
            +
                    - 2
         | 
| 34 | 
            +
                    - 2
         | 
| 35 | 
            +
                    - 0
         | 
| 36 | 
            +
                    version: 2.2.0
         | 
| 37 | 
            +
              type: :runtime
         | 
| 38 | 
            +
              name: activerecord
         | 
| 39 | 
            +
              prerelease: false
         | 
| 40 | 
            +
              version_requirements: *id001
         | 
| 41 | 
            +
            - !ruby/object:Gem::Dependency 
         | 
| 42 | 
            +
              requirement: &id002 !ruby/object:Gem::Requirement 
         | 
| 43 | 
            +
                none: false
         | 
| 44 | 
            +
                requirements: 
         | 
| 45 | 
            +
                - - ">="
         | 
| 46 | 
            +
                  - !ruby/object:Gem::Version 
         | 
| 47 | 
            +
                    hash: 7
         | 
| 48 | 
            +
                    segments: 
         | 
| 49 | 
            +
                    - 2
         | 
| 50 | 
            +
                    - 2
         | 
| 51 | 
            +
                    - 0
         | 
| 52 | 
            +
                    version: 2.2.0
         | 
| 53 | 
            +
              type: :runtime
         | 
| 54 | 
            +
              name: activesupport
         | 
| 55 | 
            +
              prerelease: false
         | 
| 56 | 
            +
              version_requirements: *id002
         | 
| 57 | 
            +
            description: Write-through and Read-through Cacheing for ActiveRecord
         | 
| 58 | 
            +
            email: teamplatform@ngmoco.com
         | 
| 59 | 
            +
            executables: []
         | 
| 60 | 
            +
             | 
| 61 | 
            +
            extensions: []
         | 
| 62 | 
            +
             | 
| 63 | 
            +
            extra_rdoc_files: 
         | 
| 64 | 
            +
            - LICENSE
         | 
| 65 | 
            +
            - README
         | 
| 66 | 
            +
            - README.markdown
         | 
| 67 | 
            +
            - TODO
         | 
| 68 | 
            +
            files: 
         | 
| 69 | 
            +
            - README
         | 
| 70 | 
            +
            - TODO
         | 
| 71 | 
            +
            - UNSUPPORTED_FEATURES
         | 
| 72 | 
            +
            - init.rb
         | 
| 73 | 
            +
            - lib/cache_money.rb
         | 
| 74 | 
            +
            - lib/cash/accessor.rb
         | 
| 75 | 
            +
            - lib/cash/buffered.rb
         | 
| 76 | 
            +
            - lib/cash/config.rb
         | 
| 77 | 
            +
            - lib/cash/fake.rb
         | 
| 78 | 
            +
            - lib/cash/finders.rb
         | 
| 79 | 
            +
            - lib/cash/index.rb
         | 
| 80 | 
            +
            - lib/cash/local.rb
         | 
| 81 | 
            +
            - lib/cash/lock.rb
         | 
| 82 | 
            +
            - lib/cash/mock.rb
         | 
| 83 | 
            +
            - lib/cash/query/abstract.rb
         | 
| 84 | 
            +
            - lib/cash/query/calculation.rb
         | 
| 85 | 
            +
            - lib/cash/query/primary_key.rb
         | 
| 86 | 
            +
            - lib/cash/query/select.rb
         | 
| 87 | 
            +
            - lib/cash/request.rb
         | 
| 88 | 
            +
            - lib/cash/transactional.rb
         | 
| 89 | 
            +
            - lib/cash/util/active_record.rb
         | 
| 90 | 
            +
            - lib/cash/util/array.rb
         | 
| 91 | 
            +
            - lib/cash/util/marshal.rb
         | 
| 92 | 
            +
            - lib/cash/write_through.rb
         | 
| 93 | 
            +
            - lib/mem_cached_session_store.rb
         | 
| 94 | 
            +
            - lib/mem_cached_support_store.rb
         | 
| 95 | 
            +
            - lib/memcached_wrapper.rb
         | 
| 96 | 
            +
            - LICENSE
         | 
| 97 | 
            +
            - README.markdown
         | 
| 98 | 
            +
            - config/environment.rb
         | 
| 99 | 
            +
            - config/memcached.yml
         | 
| 100 | 
            +
            - db/schema.rb
         | 
| 101 | 
            +
            - spec/cash/accessor_spec.rb
         | 
| 102 | 
            +
            - spec/cash/active_record_spec.rb
         | 
| 103 | 
            +
            - spec/cash/buffered_spec.rb
         | 
| 104 | 
            +
            - spec/cash/calculations_spec.rb
         | 
| 105 | 
            +
            - spec/cash/finders_spec.rb
         | 
| 106 | 
            +
            - spec/cash/local_buffer_spec.rb
         | 
| 107 | 
            +
            - spec/cash/local_spec.rb
         | 
| 108 | 
            +
            - spec/cash/lock_spec.rb
         | 
| 109 | 
            +
            - spec/cash/marshal_spec.rb
         | 
| 110 | 
            +
            - spec/cash/order_spec.rb
         | 
| 111 | 
            +
            - spec/cash/transactional_spec.rb
         | 
| 112 | 
            +
            - spec/cash/window_spec.rb
         | 
| 113 | 
            +
            - spec/cash/write_through_spec.rb
         | 
| 114 | 
            +
            - spec/memcached_wrapper_test.rb
         | 
| 115 | 
            +
            - spec/spec_helper.rb
         | 
| 116 | 
            +
            has_rdoc: true
         | 
| 117 | 
            +
            homepage: http://github.com/ngmoco/cache-money
         | 
| 118 | 
            +
            licenses: []
         | 
| 119 | 
            +
             | 
| 120 | 
            +
            post_install_message: 
         | 
| 121 | 
            +
            rdoc_options: 
         | 
| 122 | 
            +
            - --charset=UTF-8
         | 
| 123 | 
            +
            require_paths: 
         | 
| 124 | 
            +
            - lib
         | 
| 125 | 
            +
            required_ruby_version: !ruby/object:Gem::Requirement 
         | 
| 126 | 
            +
              none: false
         | 
| 127 | 
            +
              requirements: 
         | 
| 128 | 
            +
              - - ">="
         | 
| 129 | 
            +
                - !ruby/object:Gem::Version 
         | 
| 130 | 
            +
                  hash: 3
         | 
| 131 | 
            +
                  segments: 
         | 
| 132 | 
            +
                  - 0
         | 
| 133 | 
            +
                  version: "0"
         | 
| 134 | 
            +
            required_rubygems_version: !ruby/object:Gem::Requirement 
         | 
| 135 | 
            +
              none: false
         | 
| 136 | 
            +
              requirements: 
         | 
| 137 | 
            +
              - - ">="
         | 
| 138 | 
            +
                - !ruby/object:Gem::Version 
         | 
| 139 | 
            +
                  hash: 3
         | 
| 140 | 
            +
                  segments: 
         | 
| 141 | 
            +
                  - 0
         | 
| 142 | 
            +
                  version: "0"
         | 
| 143 | 
            +
            requirements: []
         | 
| 144 | 
            +
             | 
| 145 | 
            +
            rubyforge_project: 
         | 
| 146 | 
            +
            rubygems_version: 1.3.7
         | 
| 147 | 
            +
            signing_key: 
         | 
| 148 | 
            +
            specification_version: 3
         | 
| 149 | 
            +
            summary: Write-through and Read-through Cacheing for ActiveRecord
         | 
| 150 | 
            +
            test_files: 
         | 
| 151 | 
            +
            - config/environment.rb
         | 
| 152 | 
            +
            - config/memcached.yml
         | 
| 153 | 
            +
            - db/schema.rb
         | 
| 154 | 
            +
            - spec/cash/accessor_spec.rb
         | 
| 155 | 
            +
            - spec/cash/active_record_spec.rb
         | 
| 156 | 
            +
            - spec/cash/buffered_spec.rb
         | 
| 157 | 
            +
            - spec/cash/calculations_spec.rb
         | 
| 158 | 
            +
            - spec/cash/finders_spec.rb
         | 
| 159 | 
            +
            - spec/cash/local_buffer_spec.rb
         | 
| 160 | 
            +
            - spec/cash/local_spec.rb
         | 
| 161 | 
            +
            - spec/cash/lock_spec.rb
         | 
| 162 | 
            +
            - spec/cash/marshal_spec.rb
         | 
| 163 | 
            +
            - spec/cash/order_spec.rb
         | 
| 164 | 
            +
            - spec/cash/transactional_spec.rb
         | 
| 165 | 
            +
            - spec/cash/window_spec.rb
         | 
| 166 | 
            +
            - spec/cash/write_through_spec.rb
         | 
| 167 | 
            +
            - spec/memcached_wrapper_test.rb
         | 
| 168 | 
            +
            - spec/spec_helper.rb
         |