Skip to content

Commit

Permalink
feat(providers): add redis, redis-factory providers
Browse files Browse the repository at this point in the history
  • Loading branch information
thetutlage committed Jul 8, 2016
1 parent 701e7f3 commit 3323dd3
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 0 deletions.
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@
"lodash": "^4.13.1",
"node-exceptions": "^1.0.1"
},
"peerDependencies": {
"adonis-fold": "^3.0.2"
},
"devDependencies": {
"adonis-fold": "^3.0.2",
"chai": "^3.4.1",
"co-mocha": "^1.1.2",
"coveralls": "^2.11.9",
Expand Down
24 changes: 24 additions & 0 deletions providers/RedisFactoryProvider.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
'use strict'

/**
* adonis-redis
*
* (c) Harminder Virk <virk@adonisjs.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

const ServiceProvider = require('adonis-fold').ServiceProvider

class RedisFactoryProvider extends ServiceProvider {

* register () {
this.app.bind('Adonis/Addons/RedisFactory', function () {
return require('../src/RedisFactory')
})
}

}

module.exports = RedisFactoryProvider
27 changes: 27 additions & 0 deletions providers/RedisProvider.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
'use strict'

/**
* adonis-redis
*
* (c) Harminder Virk <virk@adonisjs.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

const ServiceProvider = require('adonis-fold').ServiceProvider

class RedisProvider extends ServiceProvider {

* register () {
this.app.singleton('Adonis/Addons/Redis', function (app) {
const RedisFactory = app.use('Adonis/Addons/RedisFactory')
const Config = app.use('Adonis/Src/Config')
const Redis = require('../src/Redis')
return new Redis(Config, RedisFactory)
})
}

}

module.exports = RedisProvider

0 comments on commit 3323dd3

Please sign in to comment.