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
coreospackage
Commits
0cd214f3
Commit
0cd214f3
authored
7 years ago
by
Sandeep S. Shewalkar
Browse files
Options
Downloads
Patches
Plain Diff
LAzy writer
RemoveDataFromCacheForAppend added inside lazy writer
parent
28ebd705
Branches
Branches containing commit
1 merge request
!43
Lazy writer
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dalhelper/lazywriter.go
+37
-0
dalhelper/lazywriter.go
with
37 additions
and
0 deletions
dalhelper/lazywriter.go
+
37
−
0
View file @
0cd214f3
...
...
@@ -440,3 +440,40 @@ func appendDataToFDB(filePath string, objectData interface{}) {
func
Save
(
filePath
string
,
data
interface
{})
{
saveDataToFDB
(
filePath
,
data
)
}
// RemoveDataFromCacheForAppend Removes Data From Cache
func
(
lfd
*
LazyFDPHelper
)
RemoveDataFromCacheForAppend
(
identifier
string
)
{
// Fetch All Rows and then save into db
cachedObjectList
:=
lfd
.
gc
.
GetALL
()
for
item
:=
range
cachedObjectList
{
//TODO: catch errors
cachedObject
,
getError
:=
lfd
.
gc
.
Get
(
item
)
if
getError
!=
nil
{
logginghelper
.
LogError
(
"error occured while getting "
,
item
,
" from gcache"
)
}
cachedObjectActual
,
_
:=
cachedObject
.
(
LazyCacheObject
)
if
cachedObjectActual
.
Identifier
==
identifier
{
if
cachedObjectActual
.
ChangeCount
>
0
{
cachedObjectActual
.
IsLocked
=
true
appendDataToFDB
(
cachedObjectActual
.
FileName
,
cachedObjectActual
.
InterfaceData
)
cachedObjectActual
.
ChangeCount
=
0
cachedObjectActual
.
IsLocked
=
false
lazyMutex
.
Lock
()
lfd
.
DISK_WRITE_COUNT
++
lazyMutex
.
Unlock
()
// if isDebugMode {appendDataToFDB
// lazyCacheObject := PerformanceAnalyser[cachedObjectActual.FileName]
// lazyCacheObject.DISK_WRITE_COUNT++
// PerformanceAnalyser[cachedObjectActual.FileName] = lazyCacheObject
// }
}
lazyMutex
.
Lock
()
lfd
.
gc
.
Remove
(
cachedObjectActual
.
FileName
)
lazyMutex
.
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