supercache 0.1.0 → 0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 15003e76bbf08eb46bab302705a1bd8130d38e36
4
- data.tar.gz: 391623b445703d6c688fe53fac1c3942aa0431c0
3
+ metadata.gz: 40f7c6b4073a57fe2a01c1f341a542f70991c90b
4
+ data.tar.gz: bef0b523d04d534f4ddb581d40f984282e93a5df
5
5
  SHA512:
6
- metadata.gz: c96e0f67851e5e9584f0c22fe4ef3f67cd901bf460a18ea7cea4e2c1ff10a1b3317f98f00ff5c9f9359be06f7a775f6e203c495d6716eecdd9697c2dc3af33e7
7
- data.tar.gz: 8a1f78661478745ac9afb1af5e9b3f1311a278ba15b901130adcac594b354d400eddb4b5e733a9bb29da89fd310ff755cfbf0a331513389ad5d3ba1d98342833
6
+ metadata.gz: f580d3c3a77a7cfc0ee09cfe5e9cc20d9b8f631a4cb55aaa4407a943934a29200cd5fd99ef6654dc00f2f983ae313bf39e2aa4a3c8e92f6a0b29d75df0469652
7
+ data.tar.gz: 28515ecb1c75581dd0141c2f9148586df203d187fc0292d51321ffdd57aa8ce792a6f66d5200a79d6a7b19995ec51db12c3e97c8089f11b4cbcd818d77303466
@@ -0,0 +1,18 @@
1
+ module Supercache
2
+ class DashboardController < ActionController::Base
3
+ def flip
4
+ if cache.read(:supercache)
5
+ cache.clear #Deliberately Clear all the cache available
6
+ else
7
+ cache.write(:supercache, true)
8
+ end
9
+ redirect_to :root
10
+ end
11
+
12
+ private
13
+
14
+ def cache
15
+ Rails.cache
16
+ end
17
+ end
18
+ end
@@ -0,0 +1 @@
1
+ <%= yield %>
@@ -0,0 +1,5 @@
1
+ Supercache is currently <%= Rails.cache.read(:supercache)? 'ON' : 'OFF' %>
2
+
3
+ <br>
4
+
5
+ <%= link_to 'Toggle', flip_dashboard_index_path %>
data/config/routes.rb ADDED
@@ -0,0 +1,9 @@
1
+ Supercache::Engine.routes.draw do
2
+ root to: "dashboard#index"
3
+
4
+ resources :dashboard, only: [:index] do
5
+ collection do
6
+ get :flip
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,5 @@
1
+ module Supercache
2
+ class Engine < ::Rails::Engine
3
+ isolate_namespace Supercache
4
+ end
5
+ end
@@ -0,0 +1,13 @@
1
+ module SuperQueryCache
2
+ def cache_sql(sql, binds)
3
+ if Rails.cache.read(:supercache)
4
+ Rails.cache.fetch("supercache_#{sql}_#{binds.to_s}".hash) do
5
+ super(sql, binds)
6
+ end
7
+ else
8
+ super(sql, binds)
9
+ end
10
+ end
11
+ end
12
+
13
+ ActiveRecord::ConnectionAdapters::AbstractAdapter.prepend(SuperQueryCache)
@@ -1,3 +1,3 @@
1
1
  module Supercache
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2"
3
3
  end
data/lib/supercache.rb CHANGED
@@ -1,5 +1,7 @@
1
1
  require "supercache/version"
2
+ require "supercache/engine"
3
+ require "supercache/super_query_cache"
2
4
 
3
5
  module Supercache
4
- # Your code goes here...
6
+
5
7
  end
data/supercache.gemspec CHANGED
@@ -6,13 +6,13 @@ require 'supercache/version'
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = "supercache"
8
8
  spec.version = Supercache::VERSION
9
- spec.authors = ["Bragadeesh J"]
10
- spec.email = ["bragboy@gmail.com"]
9
+ spec.authors = ['Bragadeesh J']
10
+ spec.email = ['bragboy@gmail.com']
11
11
 
12
12
  spec.summary = %q{Speed up Development time}
13
13
  spec.description = %q{SuperCache speeds up development time by caching recurring requests and lets you concentrate only on the objects you are changing/playing around with in a complete un-obtrusive manner}
14
- spec.homepage = "https://github.com/bragboy/supercache"
15
- spec.license = "MIT"
14
+ spec.homepage = 'https://github.com/bragboy/supercache'
15
+ spec.license = 'MIT'
16
16
 
17
17
  spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
18
18
  spec.bindir = "exe"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: supercache
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: '0.2'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bragadeesh J
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-08-16 00:00:00.000000000 Z
11
+ date: 2016-08-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -69,9 +69,15 @@ files:
69
69
  - LICENSE.txt
70
70
  - README.md
71
71
  - Rakefile
72
+ - app/controllers/supercache/dashboard_controller.rb
73
+ - app/views/layouts/supercache/application.html.erb
74
+ - app/views/supercache/dashboard/index.html.erb
72
75
  - bin/console
73
76
  - bin/setup
77
+ - config/routes.rb
74
78
  - lib/supercache.rb
79
+ - lib/supercache/engine.rb
80
+ - lib/supercache/super_query_cache.rb
75
81
  - lib/supercache/version.rb
76
82
  - supercache.gemspec
77
83
  homepage: https://github.com/bragboy/supercache