diff options
author | Giuseppe Castagno <giuseppe.castagno@acca-esse.eu> | 2016-01-10 17:32:53 +0100 |
---|---|---|
committer | Giuseppe Castagno <giuseppe.castagno@acca-esse.eu> | 2016-07-29 13:36:30 +0000 |
commit | 2c0b4ff238f39b5fcce09c7d36e80ac1e7cb713e (patch) | |
tree | 7e9ebdcbb1b9f034ca9205dd48cc1c6967a08f0e | |
parent | ee79a2dd7ea60e902cab3a9203e307b8a78fee23 (diff) |
tdf#101094 (11): Add WebDAV options cache configuration param.
Added in officecfg five new properties to be able to set
cache lifetime if needed.
The new properties are available in advanced, expert configuration only,
in org.openoffice.Inet.Settings.
Default values are as follows (value is in seconds):
OptsCacheLifeImplWeb = 300
when the web resource is Web only, implementing OPTIONS.
Min. 0 sec (no caching) max. 3600 sec (1h).
OptsCacheLifeDAV = 60
when the web resource is WebDAV.
Min. 0 sec (no caching) max. 3600 sec (1h).
OptsCacheLifeDAVLocked = 600
when the web resource is WebDAV and it's locked by
this LO instance (e.g. lock store has a lock to it).
Min. 0 sec (no caching) max. 3600 sec (1h).
OptsCacheLifeNotImpl = 3600
when the web resource does not implement OPTIONS method.
Min. 0 sec (no caching) max. 43200 sec (12h).
OptsCacheLifeNotFound = 15
when the requested web resource is not found on server.
Min. 0 sec (no caching) max. 30 sec.
Change-Id: I719b97645e1d91a29134820b77678fd88fcb9ac2
Reviewed-on: https://gerrit.libreoffice.org/27684
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Giuseppe Castagno <giuseppe.castagno@acca-esse.eu>
-rw-r--r-- | officecfg/registry/schema/org/openoffice/Inet.xcs | 32 | ||||
-rw-r--r-- | ucb/source/ucp/webdav-neon/webdavcontent.cxx | 37 | ||||
-rw-r--r-- | ucb/source/ucp/webdav-neon/webdavcontent.hxx | 17 |
3 files changed, 86 insertions, 0 deletions
diff --git a/officecfg/registry/schema/org/openoffice/Inet.xcs b/officecfg/registry/schema/org/openoffice/Inet.xcs index f5dcc6a817ac..76d5d2ed0912 100644 --- a/officecfg/registry/schema/org/openoffice/Inet.xcs +++ b/officecfg/registry/schema/org/openoffice/Inet.xcs @@ -163,6 +163,38 @@ </info> <value>60</value> </prop> + <!-- WebDAV OPTIONS cache lifetime time values --> + <prop oor:name="OptsCacheLifeImplWeb" oor:type="xs:int" oor:nillable="false"> + <info> + <desc>Specifies the Web/DAV resource OPTIONS cache lifetime, when the web resource is Web only, implementing OPTIONS. Time in seconds. Min. 0 sec (no caching) max. 3600 sec (1h), default to 300 (5m).</desc> + </info> + <value>300</value> + </prop> + <prop oor:name="OptsCacheLifeDAV" oor:type="xs:int" oor:nillable="false"> + <info> + <desc>Specifies the Web/DAV resource OPTIONS cache lifetime, when the web resource is WebDAV. Time in seconds. Min. 0 sec (no caching) max. 3600 sec (1h), default to 60 (1m).</desc> + </info> + <value>60</value> + </prop> + <prop oor:name="OptsCacheLifeDAVLocked" oor:type="xs:int" oor:nillable="false"> + <info> + <desc>Specifies the Web/DAV resource OPTIONS cache lifetime, when the web resource is WebDAV and the resource is locked. Time in seconds. Min. 0 sec (no caching) max. 3600 sec (1h), default to 600 (10m).</desc> + </info> + <value>600</value> + </prop> + <prop oor:name="OptsCacheLifeNotImpl" oor:type="xs:int" oor:nillable="false"> + <info> + <desc>Specifies the Web/DAV resource OPTIONS cache lifetime, when the web resource does not implement OPTIONS method. Time in seconds. Min. 0 sec (no caching) max. 43200 sec (12h), default to 3600 (1h)</desc> + </info> + <value>3600</value> + </prop> + <prop oor:name="OptsCacheLifeNotFound" oor:type="xs:int" oor:nillable="false"> + <info> + <desc>Specifies the Web/DAV resource OPTIONS cache lifetime, when the web resource is not found on server. Time in seconds. Min. 0 sec (no caching) max. 30 sec, default to 15 (15 sec).</desc> + </info> + <value>15</value> + </prop> + <!-- End of WebDAV OPTIONS cache lifetime time values --> </group> </component> </oor:component-schema> diff --git a/ucb/source/ucp/webdav-neon/webdavcontent.cxx b/ucb/source/ucp/webdav-neon/webdavcontent.cxx index 3c40ad856656..8c84f5d8063c 100644 --- a/ucb/source/ucp/webdav-neon/webdavcontent.cxx +++ b/ucb/source/ucp/webdav-neon/webdavcontent.cxx @@ -38,6 +38,7 @@ #include "osl/doublecheckedlocking.h" #include <rtl/uri.hxx> #include <rtl/ustrbuf.hxx> +#include <officecfg/Inet.hxx> #include <ucbhelper/contentidentifier.hxx> #include <ucbhelper/propertyvalueset.hxx> #include <ucbhelper/simpleinteractionrequest.hxx> @@ -92,6 +93,12 @@ using namespace com::sun::star; using namespace webdav_ucp; +// Static value, to manage a simple OPTIONS cache +// Key is the URL, element is the DAVOptions resulting from an OPTIONS call. +// Cached DAVOptions have a lifetime that depends on the errors received or not received +// and on the value of received options. +static DAVOptionsCache aStaticDAVOptionsCache; + // Content Implementation. @@ -114,6 +121,7 @@ Content::Content( { try { + initOptsCacheLifeTime(); m_xResAccess.reset( new DAVResourceAccess( rxContext, rSessionFactory, @@ -147,6 +155,7 @@ Content::Content( { try { + initOptsCacheLifeTime(); m_xResAccess.reset( new DAVResourceAccess( rxContext, rSessionFactory, Identifier->getContentIdentifier() ) ); } @@ -165,6 +174,34 @@ Content::~Content() } +void Content::initOptsCacheLifeTime() +{ + // see description in + // officecfg/registry/schema/org/openoffice/Inet.xcs + // for use of these filed values. + sal_uInt32 nAtime; + nAtime = officecfg::Inet::Settings::OptsCacheLifeImplWeb::get( m_xContext ); + m_nOptsCacheLifeImplWeb = std::max( sal_uInt32( 0 ), + std::min( nAtime, sal_uInt32( 3600 ) ) ); + + nAtime = officecfg::Inet::Settings::OptsCacheLifeDAV::get( m_xContext ); + m_nOptsCacheLifeDAV = std::max( sal_uInt32( 0 ), + std::min( nAtime, sal_uInt32( 3600 ) ) ); + + nAtime = officecfg::Inet::Settings::OptsCacheLifeDAVLocked::get( m_xContext ); + m_nOptsCacheLifeDAVLocked = std::max( sal_uInt32( 0 ), + std::min( nAtime, sal_uInt32( 3600 ) ) ); + + nAtime = officecfg::Inet::Settings::OptsCacheLifeNotImpl::get( m_xContext ); + m_nOptsCacheLifeNotImpl = std::max( sal_uInt32( 0 ), + std::min( nAtime, sal_uInt32( 43200 ) ) ); + + nAtime = officecfg::Inet::Settings::OptsCacheLifeNotFound::get( m_xContext ); + m_nOptsCacheLifeNotFound = std::max( sal_uInt32( 0 ), + std::min( nAtime, sal_uInt32( 30 ) ) ); +} + + // XInterface methods. diff --git a/ucb/source/ucp/webdav-neon/webdavcontent.hxx b/ucb/source/ucp/webdav-neon/webdavcontent.hxx index a6cb37805a43..bda8566ae26e 100644 --- a/ucb/source/ucp/webdav-neon/webdavcontent.hxx +++ b/ucb/source/ucp/webdav-neon/webdavcontent.hxx @@ -98,6 +98,23 @@ class Content : public ::ucbhelper::ContentImplHelper, bool m_bCollection; bool m_bDidGetOrHead; std::vector< OUString > m_aFailedPropNames; + // Options Cache lifetime + // for web site implementing OPTIONS, but not dav + sal_uInt32 m_nOptsCacheLifeImplWeb; + // for WebDAV site where OPTIONS is mandatory + sal_uInt32 m_nOptsCacheLifeDAV; + // same as above, but when the resource is locked by us + sal_uInt32 m_nOptsCacheLifeDAVLocked; +// For web site not implementing OPTIONS + // during this time we assume the site doesn't turn to WebDAV + // but remains a simple Web + sal_uInt32 m_nOptsCacheLifeNotImpl; + // When resource is not found + // may be the resource is unavailable only briefly? + // so better have this small + sal_uInt32 m_nOptsCacheLifeNotFound; + + void initOptsCacheLifeTime(); private: virtual css::uno::Sequence< css::beans::Property > |