(func, key_dict=None, self=None)
Get a cache namespace and key used by the beaker_cache decorator.

    Example::
        from pylons import cache
        from pylons.decorators.cache import create_cache_key
        namespace, key = create_cache_key(MyController.some_method)
        cache.get_cache(namespace).remove(key)
Get a cache namespace and key used by the beaker_cache decorator.
Get a cache namespace and key used by the beaker_cache decorator .
def create_cache_key(func, key_dict=None, self=None):
    """Get a cache namespace and key used by the beaker_cache decorator.

    Example::
        from pylons import cache
        from pylons.decorators.cache import create_cache_key
        namespace, key = create_cache_key(MyController.some_method)
        cache.get_cache(namespace).remove(key)

    """
    kls = None
    if hasattr(func, 'im_func'):
        kls = func.im_class
        func = func.im_func
        cache_key = func.__name__
    else:
        cache_key = func.__name__
    if key_dict:
        cache_key += " " + " ".join("%s=%s" % (k, v)
                                    for k, v in key_dict.iteritems())

    if not kls and self:
        kls = getattr(self, '__class__', None)

    if kls:
        return '%s.%s' % (kls.__module__, kls.__name__), cache_key
    else:
        return func.__module__, cache_key
def create_cache_key ( func , key_dict = None , self = None ) : kls = None if hasattr ( func , 'im_func' ) : kls = func . im_class func = func . im_func cache_key = func . __name__ else : cache_key = func . __name__ if key_dict : cache_key += " " + " " . join ( "%s=%s" % ( k , v ) for k , v in key_dict . iteritems ( ) ) if not kls and self : kls = getattr ( self , '__class__' , None ) if kls : return '%s.%s' % ( kls . __module__ , kls . __name__ ) , cache_key else : return func . __module__ , cache_key