[Groonga-commit] droonga/express-droonga at 16a6dce [master] Remove "createEntry" method from Rule, to make classes independent

Back to archive index

YUKI Hiroshi null+****@clear*****
Thu Mar 20 16:17:13 JST 2014


YUKI Hiroshi	2014-03-20 16:17:13 +0900 (Thu, 20 Mar 2014)

  New Revision: 16a6dce75d876510f9a51b94a5d025f5b27e1e6e
  https://github.com/droonga/express-droonga/commit/16a6dce75d876510f9a51b94a5d025f5b27e1e6e

  Message:
    Remove "createEntry" method from Rule, to make classes independent

  Modified files:
    lib/response-cache/index.js
    lib/response-cache/rule.js
    test/response-cache/rule.test.js

  Modified: lib/response-cache/index.js (+1 -1)
===================================================================
--- lib/response-cache/index.js    2014-03-20 16:14:37 +0900 (ac3dadd)
+++ lib/response-cache/index.js    2014-03-20 16:17:13 +0900 (5ae4a58)
@@ -35,7 +35,7 @@ exports = module.exports = function(options) {
       if (cachedResponse) {
         sendCachedResponse(response, cachedResponse);
       } else {
-        var entry = rule.creteEntry();
+        var entry = new Entry(rule.ttlInMilliSeconds);
         entry.hook(response, function(cachedResponse, ttl) {
           cache.set(cacheKey, cachedResponse, ttl);
         });

  Modified: lib/response-cache/rule.js (+0 -6)
===================================================================
--- lib/response-cache/rule.js    2014-03-20 16:14:37 +0900 (2f11cd6)
+++ lib/response-cache/rule.js    2014-03-20 16:17:13 +0900 (8af2461)
@@ -1,5 +1,3 @@
-var Entry = require('./entry');
-
 function Rule(rule, options) {
   options = options || {};
 
@@ -14,10 +12,6 @@ function Rule(rule, options) {
 Rule.prototype = {
   match: function(request) {
     return this.regex.test(request.url);
-  },
-
-  createEntry: function() {
-    return new Entry(this.ttlInMilliSeconds);
   }
 };
 exports = module.exports = Rule;

  Modified: test/response-cache/rule.test.js (+0 -6)
===================================================================
--- test/response-cache/rule.test.js    2014-03-20 16:14:37 +0900 (96a0880)
+++ test/response-cache/rule.test.js    2014-03-20 16:17:13 +0900 (aa85572)
@@ -22,12 +22,6 @@ suite('Response Cache Rule', function() {
     });
   });
 
-  test('createEntry', function() {
-    var rule = new Rule({ regex: /./, ttlInMilliSeconds: 10 });
-    var entry = rule.createEntry();
-    assert.equal(entry.ttlInMilliSeconds, 10);
-  });
-
   suite('match', function() {
     test('matched', function() {
       var rule = new Rule({ regex: /foo/, ttlInMilliSeconds: 10 });
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index