Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
ZEO
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
ZEO
Commits
765fa2f7
Commit
765fa2f7
authored
Jun 05, 1998
by
Jim Fulton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added __len__ and added a functional minimize method that
tries to minimize the size of the cache.
parent
eb86ea4b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
4 deletions
+20
-4
src/ZODB/PickleCache.py
src/ZODB/PickleCache.py
+20
-4
No files found.
src/ZODB/PickleCache.py
View file @
765fa2f7
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
__doc__
=
'''PickleJar Object Cache
__doc__
=
'''PickleJar Object Cache
$Id: PickleCache.py,v 1.
2 1998/03/23 15:50:27
jim Exp $'''
$Id: PickleCache.py,v 1.
3 1998/06/05 22:20:30
jim Exp $'''
# Copyright
# Copyright
#
#
# Copyright 1996 Digital Creations, L.C., 910 Princess Anne
# Copyright 1996 Digital Creations, L.C., 910 Princess Anne
...
@@ -54,7 +54,7 @@ $Id: PickleCache.py,v 1.2 1998/03/23 15:50:27 jim Exp $'''
...
@@ -54,7 +54,7 @@ $Id: PickleCache.py,v 1.2 1998/03/23 15:50:27 jim Exp $'''
#
#
# (540) 371-6909
# (540) 371-6909
#
#
__version__
=
'$Revision: 1.
2
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.
3
$'
[
11
:
-
2
]
from
sys
import
getrefcount
from
sys
import
getrefcount
...
@@ -94,18 +94,34 @@ class PickleCache:
...
@@ -94,18 +94,34 @@ class PickleCache:
def
__delitem__
(
self
,
key
):
del
self
.
data
[
key
]
def
__delitem__
(
self
,
key
):
del
self
.
data
[
key
]
def
__len__
(
self
):
return
len
(
self
.
data
)
def
values
(
self
):
return
self
.
data
.
values
()
def
values
(
self
):
return
self
.
data
.
values
()
def
full_sweep
(
self
):
def
full_sweep
(
self
):
cache
=
self
.
data
cache
=
self
.
data
for
id
in
cache
.
keys
():
for
id
in
cache
.
keys
():
if
getrefcount
(
cache
[
id
])
<=
2
:
del
cache
[
id
]
if
getrefcount
(
cache
[
id
])
<=
2
:
del
cache
[
id
]
minimize
=
full_sweep
def
minimize
(
self
):
cache
=
self
.
data
keys
=
cache
.
keys
()
rc
=
getrefcount
last
=
None
l
=
len
(
cache
)
while
l
!=
last
:
for
id
in
keys
():
if
rc
(
cache
[
id
])
<=
2
:
del
cache
[
id
]
cache
[
id
].
_p_deactivate
()
l
=
len
(
cache
)
############################################################################
############################################################################
#
#
# $Log: PickleCache.py,v $
# $Log: PickleCache.py,v $
# Revision 1.3 1998/06/05 22:20:30 jim
# Added __len__ and added a functional minimize method that
# tries to minimize the size of the cache.
#
# Revision 1.2 1998/03/23 15:50:27 jim
# Revision 1.2 1998/03/23 15:50:27 jim
# Added import of getrefcound from sys.
# Added import of getrefcound from sys.
#
#
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment