Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Kirill Smelkov
ZODB
Commits
7d838574
Commit
7d838574
authored
25 years ago
by
Jim Fulton
Browse files
Options
Download
Email Patches
Plain Diff
Added a small cache for modifiedInVersion, which is called often from management interface.
parent
cc20899f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
3 deletions
+23
-3
trunk/src/ZODB/DB.py
trunk/src/ZODB/DB.py
+23
-3
No files found.
trunk/src/ZODB/DB.py
View file @
7d838574
...
...
@@ -84,8 +84,8 @@
##############################################################################
"""Database objects
$Id: DB.py,v 1.1
1
1999/07/
14
1
1
:3
2
:3
1
jim Exp $"""
__version__
=
'$Revision: 1.1
1
$'
[
11
:
-
2
]
$Id: DB.py,v 1.1
2
1999/07/
30
1
4
:3
4
:3
3
jim Exp $"""
__version__
=
'$Revision: 1.1
2
$'
[
11
:
-
2
]
import
cPickle
,
cStringIO
,
sys
,
POSException
from
Connection
import
Connection
...
...
@@ -149,8 +149,10 @@ class DB:
self
.
_version_cache_size
=
version_cache_size
self
.
_version_cache_deactivate_after
=
version_cache_deactivate_after
self
.
_miv_cache
=
{}
# Pass through methods:
for
m
in
(
'history'
,
'modifiedInVersion'
,
for
m
in
(
'history'
,
'supportsUndo'
,
'supportsVersions'
,
'undoLog'
,
'versionEmpty'
,
'versions'
):
setattr
(
self
,
m
,
getattr
(
storage
,
m
))
...
...
@@ -310,6 +312,14 @@ class DB:
if
connection
is
not
None
:
version
=
connection
.
_version
self
.
_a
()
try
:
# Update modified in version cache
h
=
hash
(
oid
)
%
131
cache
=
self
.
_miv_cache
o
=
cache
.
get
(
h
,
None
)
if
o
and
o
[
0
]
==
oid
:
del
cache
[
h
]
# Notify connections
pools
,
pooll
=
self
.
_pools
for
pool
,
allocated
in
pooll
:
for
cc
in
allocated
:
...
...
@@ -336,6 +346,16 @@ class DB:
else
:
for
oid
in
oids
:
self
.
invalidate
(
oid
,
version
=
version
)
def
modifiedInVersion
(
self
,
oid
):
h
=
hash
(
oid
)
%
131
cache
=
self
.
_miv_cache
o
=
cache
.
get
(
h
,
None
)
if
o
and
o
[
0
]
==
oid
:
return
o
[
1
]
v
=
self
.
_storage
.
modifiedInVersion
(
oid
)
cache
[
h
]
=
oid
,
v
return
v
def
objectCount
(
self
):
return
len
(
self
.
_storage
)
def
open
(
self
,
version
=
''
,
transaction
=
None
,
temporary
=
0
,
force
=
None
,
...
...
This diff is collapsed.
Click to expand it.
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