-
-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(providers): add redis, redis-factory providers
- Loading branch information
1 parent
701e7f3
commit 3323dd3
Showing
3 changed files
with
55 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |