Skip to content
Browse files

Added comments, modified README.md

  • Loading branch information...
1 parent 163bca6 commit 10cf6ac6a30335ec3ce36f1ce6032d51b740f313 @spcsser spcsser committed
Showing with 18 additions and 1 deletion.
  1. +8 −0 CacheAndBufferLayer.js
  2. +9 −0 README.md
  3. +1 −1 findKeysTest.js
View
8 CacheAndBufferLayer.js
@@ -83,6 +83,10 @@ exports.database = function(wrappedDB, settings, logger)
//set the flushing flag to false, this flag shows that there is a flushing action happing at the moment
this.isFlushing = false;
+ /**
+ * Adds function to db wrapper for findKey regex.
+ * Used by document dbs like mongodb or dirty.
+ */
wrappedDB.createFindRegex = function(key, notKey){
var regex="";
key=key.replace(/\*/g,".*");
@@ -196,6 +200,10 @@ exports.database.prototype.get = function(key, callback)
}
}
+/**
+ * Find keys function searches the db sets for matching entries and
+ * returns the key entries via callback.
+ */
exports.database.prototype.findKeys = function(key, notKey, callback){
var bufferKey=key+"-"+notKey;
var self = this;
View
9 README.md
@@ -57,5 +57,14 @@ db.init(function (err)
#How to add support for another database
Look at sqlite_db.js and mysql_db.js, your module have to provide the same functions. Call it DATABASENAME_db.js and reimplement the functions for your database. If you think it works, test it with `node benchmark.js DATABASENAME`. Benchmark.js is benchmark and test at the same time. It tries to set 100000 values. You can pipe stderr to a file and will create a csv with benchmark results.
+#Limitations
+Only mysql, dirty and mongodb currently support findKeys feature. The following are lacking the functionality:
+* couch
+* leveldb
+* postgres
+* redis
+* sqlite
+For details on how it works please refer to the wiki: https://github.com/Pita/ueberDB/wiki/findKeys-functionality
+
#License
[Apache License v2](http://www.apache.org/licenses/LICENSE-2.0.html)
View
2 findKeysTest.js
@@ -53,7 +53,7 @@ function test ()
{
db.db.wrappedDB.set("test:test1:check:check1", "test:test1:check:check1", callback);
},
- //write second value
+ //write third value
function(callback)
{
db.db.wrappedDB.set("check:check1:test:test1", "check:check1:test:test1", callback);

0 comments on commit 10cf6ac

Please sign in to comment.
Something went wrong with that request. Please try again.