Skip to content
GitLab
Explore
Projects
Groups
Topics
Snippets
Projects
Groups
Topics
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
MKCLOS
Core Development Platform
corepkgv2
Commits
d824c8de
Commit
d824c8de
authored
5 years ago
by
Deepak Prakash Karn
Browse files
Options
Downloads
Patches
Plain Diff
Adding new method in cachemdl
Changes related to GetItemsCount Method added in cachemdl
parent
9a33a728
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!91
Dpk cache method add
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
cachemdl/cachemdl.go
+5
-0
cachemdl/cachemdl.go
statemdl/state.go
+28
-0
statemdl/state.go
with
33 additions
and
0 deletions
cachemdl/cachemdl.go
+
5
−
0
View file @
d824c8de
...
...
@@ -50,3 +50,8 @@ func (fastCacheHelper *FastCacheHelper) Purge() {
func
(
fastCacheHelper
*
FastCacheHelper
)
Delete
(
key
string
)
{
fastCacheHelper
.
FastCache
.
Delete
(
key
)
}
// GetItemsCount : Number of items in the cache
func
(
fastCacheHelper
*
FastCacheHelper
)
GetItemsCount
()
int
{
return
fastCacheHelper
.
FastCache
.
ItemCount
()
}
This diff is collapsed.
Click to expand it.
statemdl/state.go
+
28
−
0
View file @
d824c8de
...
...
@@ -40,6 +40,8 @@ type clientResponse struct {
QueryState
map
[
string
]
Statistic
`json:"queryState"`
TotalSMS
int64
`json:"totalSMS"`
TotalEmail
int64
`json:"totalEmail"`
TotalOTP
int64
`json:"totalOTP"`
OTPInCache
int64
`json:"otpInCache"`
TotalMongoHits
int64
`json:"totalMongoHits"`
TotalMySQLHits
int64
`json:"totalMySQLHits"`
TotalHits
int64
`json:"totalHits"`
...
...
@@ -53,6 +55,8 @@ type clientResponse struct {
type
entityHits
struct
{
TotalSMS
int64
`json:"totalSMS"`
TotalEmail
int64
`json:"totalEmail"`
TotalOTP
int64
`json:"totalOTP"`
OTPInCache
int64
`json:"otpInCache"`
Mutex
*
sync
.
Mutex
}
...
...
@@ -280,6 +284,26 @@ func EmailHits() {
entityHitsObj
.
TotalEmail
++
}
// OTPHits - update only OTPs hits count for all services -- DPK [12-June-2018]
func
OTPHits
()
{
if
!
initStatus
{
return
}
entityHitsObj
.
Mutex
.
Lock
()
entityHitsObj
.
TotalOTP
++
entityHitsObj
.
Mutex
.
Unlock
()
}
// OTPInCache - update only OTPs hits count for all services -- DPK [12-June-2018]
func
OTPInCache
(
count
int64
)
{
if
!
initStatus
{
return
}
entityHitsObj
.
Mutex
.
Lock
()
entityHitsObj
.
OTPInCache
=
count
entityHitsObj
.
Mutex
.
Unlock
()
}
// SMSHits - update only sms hits count for all services
func
SMSHits
()
{
if
!
initStatus
{
...
...
@@ -329,6 +353,10 @@ func collectStatistics() {
entityHitsObj
.
Mutex
.
Lock
()
clientResponseData
.
TotalEmail
+=
entityHitsObj
.
TotalEmail
entityHitsObj
.
TotalEmail
=
0
clientResponseData
.
OTPInCache
=
entityHitsObj
.
OTPInCache
entityHitsObj
.
OTPInCache
=
0
clientResponseData
.
TotalOTP
+=
entityHitsObj
.
TotalOTP
entityHitsObj
.
TotalOTP
=
0
clientResponseData
.
TotalSMS
+=
entityHitsObj
.
TotalSMS
entityHitsObj
.
TotalSMS
=
0
entityHitsObj
.
Mutex
.
Unlock
()
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Topics
Snippets