ucb: webdav-curl: Related: tdf#82677, add cache use in Content::getProperties()
[ port of commit 00e1f840be4a1ff202d82377b3cbf233b352b1c3 ]
Change-Id: I8c7f372404239276101fb7f64ba3415ef922e7e1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123482
Tested-by: Michael Stahl <michael.stahl@allotropia.de>
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
diff --git a/ucb/source/ucp/webdav-curl/webdavcontentcaps.cxx b/ucb/source/ucp/webdav-curl/webdavcontentcaps.cxx
index ca1fde4..e44e088 100644
--- a/ucb/source/ucp/webdav-curl/webdavcontentcaps.cxx
+++ b/ucb/source/ucp/webdav-curl/webdavcontentcaps.cxx
@@ -257,6 +257,8 @@ bool ContentProvider::getProperty(
}
static PropertyNamesCache aStaticPropertyNamesCache;
// Content implementation.
@@ -295,7 +297,21 @@ uno::Sequence< beans::Property > Content::getProperties(
try
{
std::vector< DAVResourceInfo > props;
xResAccess->PROPFIND( DAVZERO, props, xEnv );
OUString aTheURL( xResAccess->getURL() );
PropertyNames aPropsNames( aTheURL );
if( !aStaticPropertyNamesCache.getCachedPropertyNames( aTheURL, aPropsNames ) )
{
xResAccess->PROPFIND( DAVZERO, props, xEnv );
aPropsNames.setPropertiesNames( props );
aStaticPropertyNamesCache.addCachePropertyNames( aPropsNames, 10 );
}
else
{
props = aPropsNames.getPropertiesNames();
}
// Note: vector always contains exactly one resource info, because
// we used a depth of DAVZERO for PROPFIND.