Adjust default cache timeout based on cache subclass.
[shibboleth/sp.git] / shibsp / impl / RemotedSessionCache.cpp
index e7bdbc9..6f2d8cc 100644 (file)
@@ -105,8 +105,15 @@ namespace shibsp {
             return m_attributes;\r
         }\r
         const multimap<string,const Attribute*>& getIndexedAttributes() const {\r
-            if (m_attributes.empty())\r
-                unmarshallAttributes();\r
+            if (m_attributeIndex.empty()) {\r
+                if (m_attributes.empty())\r
+                    unmarshallAttributes();\r
+                for (vector<Attribute*>::const_iterator a = m_attributes.begin(); a != m_attributes.end(); ++a) {\r
+                    const vector<string>& aliases = (*a)->getAliases();\r
+                    for (vector<string>::const_iterator alias = aliases.begin(); alias != aliases.end(); ++alias)\r
+                        m_attributeIndex.insert(make_pair(*alias, *a));\r
+                }\r
+            }\r
             return m_attributeIndex;\r
         }\r
         const vector<const char*>& getAssertionIDs() const {\r
@@ -177,7 +184,6 @@ void RemotedSession::unmarshallAttributes() const
         try {\r
             attribute = Attribute::unmarshall(attr);\r
             m_attributes.push_back(attribute);\r
-            m_attributeIndex.insert(make_pair(attribute->getId(),attribute));\r
             if (m_cache->m_log.isDebugEnabled())\r
                 m_cache->m_log.debug("unmarshalled attribute (ID: %s) with %d value%s",\r
                     attribute->getId(), attr.first().integer(), attr.first().integer()!=1 ? "s" : "");\r
@@ -255,7 +261,7 @@ void RemotedSession::validate(const Application& application, const char* client
 }\r
 \r
 RemotedCache::RemotedCache(const DOMElement* e)\r
-    : SessionCache(e), m_log(Category::getInstance(SHIBSP_LOGCAT".SessionCache")), m_root(e), m_lock(NULL), shutdown(false)\r
+    : SessionCache(e, 900), m_log(Category::getInstance(SHIBSP_LOGCAT".SessionCache")), m_root(e), m_lock(NULL), shutdown(false)\r
 {\r
     if (!SPConfig::getConfig().getServiceProvider()->getListenerService())\r
         throw ConfigurationException("RemotedCacheService requires a ListenerService, but none available.");\r