Index: quintagroup.dropdownmenu/trunk/docs/CONTRIBUTORS.txt
===================================================================
--- quintagroup.dropdownmenu/trunk/docs/CONTRIBUTORS.txt	(revision 3322)
+++ quintagroup.dropdownmenu/trunk/docs/CONTRIBUTORS.txt	(revision 3339)
@@ -7,2 +7,3 @@
 Olha Pelishok   [olha]
 Taras Melnychuk [fenix]
+Malthe Borch
Index: quintagroup.dropdownmenu/trunk/docs/HISTORY.txt
===================================================================
--- quintagroup.dropdownmenu/trunk/docs/HISTORY.txt	(revision 3322)
+++ quintagroup.dropdownmenu/trunk/docs/HISTORY.txt	(revision 3339)
@@ -1,4 +1,9 @@
 Changelog
 =========
+
+1.2.6 - Jan 26, 2012
+
+* revisited caching key strategies, added language and anonymous switch 
+* added caching switch to control panel
 
 1.2.5 - Oct 21, 2011
Index: quintagroup.dropdownmenu/trunk/quintagroup/dropdownmenu/browser/viewlets.py
===================================================================
--- quintagroup.dropdownmenu/trunk/quintagroup/dropdownmenu/browser/viewlets.py	(revision 3322)
+++ quintagroup.dropdownmenu/trunk/quintagroup/dropdownmenu/browser/viewlets.py	(revision 3339)
@@ -23,6 +23,10 @@
 import copy
 
-
 def menu_cache_key(f, view):
+    # menu cache key conssits of:
+    # - selected item not only top tab
+    # - site can beaccessed on different domains 
+    # - language is important for multilingua sites
+
     portal_state = getMultiAdapter((view.context, view.request),
                                    name=u'plone_portal_state')
@@ -31,20 +35,29 @@
     if view.conf.content_tabs_level > 0:
         content_path = content_path[:view.conf.content_tabs_level]
-    path_key = '/'.join(content_path)
+    path_key = view.request.physicalPathToURL(content_path)
+
+    language = portal_state.locale().getLocaleID()
+
+    # Cache for five minutes. Note that the HTTP RAM-cache
+    # typically purges entries after 60 minutes.
     return view.__name__ + \
            path_key + \
-           str(time() // (60 * 5))  # Every five minutes
-                                    # Note that the HTTP RAM-cache
-                                    # typically purges entries after
-                                    # 60 minutes.
-
-
+           language + \
+           str(time() // (60 * 5))  
+
+# we are gcaching the menu structure built out of portal_actions tool
+# this cache key does not take in account expressions and roles settings
 def tabs_cache_key(f, view, site_url):
     return site_url + str(time() // (60 * 60))
 
-
 def dropdowncache(f):
     def func(view):
-        if view.conf.show_actions_tabs:
+        portal_state = getMultiAdapter((view.context, view.request),
+                                        name=u'plone_portal_state')
+        # it is impossible to reliably cache entire rendered menu generated  
+        # with potral actions strategy.
+        if not view.conf.enable_caching or view.conf.show_actions_tabs or \
+           (not portal_state.anonymous() and \
+                view.conf.caching_strategy == 'anonymous'):
             return f(view)
         return ram.cache(menu_cache_key)(f)(view)
@@ -55,4 +68,5 @@
     index = ViewPageTemplateFile('templates/sections.pt')
     recurse = ViewPageTemplateFile('templates/sections_recurse.pt')
+
 
     def update(self):
Index: quintagroup.dropdownmenu/trunk/quintagroup/dropdownmenu/interfaces.py
===================================================================
--- quintagroup.dropdownmenu/trunk/quintagroup/dropdownmenu/interfaces.py	(revision 3322)
+++ quintagroup.dropdownmenu/trunk/quintagroup/dropdownmenu/interfaces.py	(revision 3339)
@@ -4,7 +4,12 @@
 
 from plone.theme.interfaces import IDefaultPloneLayer
+from zope.schema.vocabulary import SimpleVocabulary, SimpleTerm
 
 from quintagroup.dropdownmenu import _
 
+cachings = SimpleVocabulary(
+    [SimpleTerm(value=u'anonymous', title=_(u'Cache only for anonymous')),
+     SimpleTerm(value=u'all', title=_(u'Cache for all users')),]
+    )
 
 class IDropDownMenuLayer(IDefaultPloneLayer):
@@ -78,2 +83,16 @@
         default=u"_sub",
         required=False)
+    
+    enable_caching = schema.Bool(
+        title=_(u"Enable menu caching"),
+        description=_(u"Caching of the menu viewlet improves page rendering "
+                      u"speed."),
+        default=True        
+        )
+
+    caching_strategy = schema.Choice(
+    title=_(u"Select caching strategy"),
+    description=_(u"Caching strategy defines how the cache key will be built."),
+    default="anonymous",
+    vocabulary=cachings        
+    )
Index: quintagroup.dropdownmenu/trunk/setup.py
===================================================================
--- quintagroup.dropdownmenu/trunk/setup.py	(revision 3322)
+++ quintagroup.dropdownmenu/trunk/setup.py	(revision 3339)
@@ -2,5 +2,5 @@
 import os
 
-version = '1.2.5'
+version = '1.2.6'
 
 tests_require = ['zope.testing',
@@ -15,4 +15,6 @@
         "Framework :: Plone",
         "Programming Language :: Python",
+        "License :: OSI Approved :: GNU General Public License (GPL)",
+        "Operating System :: OS Independent"
         "Topic :: Software Development :: Libraries :: Python Modules",
         ],
