FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
evolution-api/src/cache/cacheengine.ts at main · gitsofian/evolution-api · GitHub
gitsofian
/
evolution-api
Public
forked from
evolution-foundation/evolution-api
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
evolution-api
/
src
/
cache
/
cacheengine.ts
Copy path
More file actions
More file actions
Latest commit
History
History
History
31 lines (25 loc) · 924 Bytes
Breadcrumbs
evolution-api
/
src
/
cache
/
cacheengine.ts
Copy path
File metadata and controls
31 lines (25 loc) · 924 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import
{
ICache
}
from
'@api/abstract/abstract.cache'
;
import
{
CacheConf
,
ConfigService
}
from
'@config/env.config'
;
import
{
Logger
}
from
'@config/logger.config'
;
import
{
LocalCache
}
from
'./localcache'
;
import
{
RedisCache
}
from
'./rediscache'
;
const
logger
=
new
Logger
(
'CacheEngine'
)
;
export
class
CacheEngine
{
private
engine
:
ICache
;
constructor
(
private
readonly
configService
:
ConfigService
,
module
:
string
,
)
{
const
cacheConf
=
configService
.
get
<
CacheConf
>
(
'CACHE'
)
;
if
(
cacheConf
?.
REDIS
?.
ENABLED
&&
cacheConf
?.
REDIS
?.
URI
!==
''
)
{
logger
.
verbose
(
`RedisCache initialized for
${
module
}
`
)
;
this
.
engine
=
new
RedisCache
(
configService
,
module
)
;
}
else
if
(
cacheConf
?.
LOCAL
?.
ENABLED
)
{
logger
.
verbose
(
`LocalCache initialized for
${
module
}
`
)
;
this
.
engine
=
new
LocalCache
(
configService
,
module
)
;
}
}
public
getEngine
(
)
{
return
this
.
engine
;
}
}
Back
|
FazBrowse Home
|
New Git URL