-
-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: cleanup and upgrade to new project style
- Loading branch information
1 parent
6ec2bd7
commit 6c0c405
Showing
31 changed files
with
432 additions
and
354 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,49 @@ | ||
/** | ||
* @module edge | ||
*/ | ||
|
||
/* | ||
* edge | ||
* | ||
* (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. | ||
*/ | ||
|
||
import { LoaderTemplate } from '../Contracts' | ||
|
||
/** | ||
* In memory cache manager to parsed pre-compiled templates | ||
*/ | ||
export class CacheManager { | ||
private _cacheStore: Map<string, LoaderTemplate> = new Map() | ||
|
||
constructor (private _enabled: boolean) { | ||
} | ||
|
||
/** | ||
* Returns the template and the presenter class from the | ||
* cache. If caching is disabled, then it will | ||
* return undefined. | ||
*/ | ||
public get (templatePath: string): undefined | LoaderTemplate { | ||
if (!this._enabled) { | ||
return | ||
} | ||
|
||
return this._cacheStore.get(templatePath) | ||
} | ||
|
||
/** | ||
* Set's the template path and the payload to the cache. If | ||
* cache is disabled, then this function returns in noop. | ||
*/ | ||
public set (templatePath: string, payload: LoaderTemplate) { | ||
if (!this._enabled) { | ||
return | ||
} | ||
|
||
this._cacheStore.set(templatePath, payload) | ||
} | ||
} |
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
Oops, something went wrong.