-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added TypeScript, restructured, added services and types, moved cache…
… logs to its service
- Loading branch information
Showing
16 changed files
with
906 additions
and
127 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
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
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
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
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
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
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,46 @@ | ||
// Simple permanent in memory cache | ||
class CacheService{ | ||
cache: Map<string, any> | ||
|
||
constructor(){ | ||
this.cache = new Map(); | ||
} | ||
|
||
set(key: string, value: any){ | ||
console.log(`Setting "${key}" to cache...`); | ||
this.cache.set(key, value); | ||
return value; | ||
} | ||
|
||
get(key: string){ | ||
console.log(`Retrieving "${key}" from cache...`); | ||
return this.cache.get(key); | ||
} | ||
|
||
delete(key: string){ | ||
console.log(`Deleting "${key}" from cache...`); | ||
return this.cache.delete(key); | ||
} | ||
|
||
clearCache(){ | ||
console.log("Clearing cache...") | ||
this.cache.clear(); | ||
} | ||
|
||
has(key: string){ | ||
const result = this.cache.has(key); | ||
if(result) console.log(`Found cache item for "${key}"...`); | ||
else console.log(`No cache item found for "${key}"...`); | ||
return result; | ||
} | ||
|
||
keys(){ | ||
return this.cache.keys(); | ||
} | ||
|
||
values(){ | ||
return this.cache.values(); | ||
} | ||
} | ||
|
||
export default CacheService; |
Oops, something went wrong.