• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python memcacheify.memcacheify函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中memcacheify.memcacheify函数的典型用法代码示例。如果您正苦于以下问题:Python memcacheify函数的具体用法?Python memcacheify怎么用?Python memcacheify使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了memcacheify函数的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: test_uses_local_memory_backend_if_no_memcachier_addon_is_available

 def test_uses_local_memory_backend_if_no_memcachier_addon_is_available(self):
     environ['MEMCACHIER_PASSWORD'] = 'xxx'
     environ['MEMCACHIER_SERVERS'] = 'mc1.ec2.memcachier.com'
     self.assertEqual(memcacheify(), {'default':
         {'BACKEND': 'django.core.cache.backends.locmem.LocMemCache'}
     })
     del environ['MEMCACHIER_PASSWORD']
     del environ['MEMCACHIER_SERVERS']
开发者ID:GetAmbassador,项目名称:django-heroku-memcacheify,代码行数:8,代码来源:tests.py


示例2: test_sets_proper_backend_when_memcache_addon_is_available

 def test_sets_proper_backend_when_memcache_addon_is_available(self):
     environ["MEMCACHE_PASSWORD"] = "GCnQ9DhfEJqNDlo1"
     environ["MEMCACHE_SERVERS"] = "mc3.ec2.northscale.net"
     environ["MEMCACHE_USERNAME"] = "appxxxxx%40heroku.com"
     self.assertEqual(memcacheify()["default"]["BACKEND"], "django_pylibmc.memcached.PyLibMCCache")
     del environ["MEMCACHE_PASSWORD"]
     del environ["MEMCACHE_SERVERS"]
     del environ["MEMCACHE_USERNAME"]
开发者ID:Mondego,项目名称:pyreco,代码行数:8,代码来源:allPythonContent.py


示例3: tests_uses_local_memory_backend_if_one_of_the_memcache_env_vars_is_missing

 def tests_uses_local_memory_backend_if_one_of_the_memcache_env_vars_is_missing(self):
     environ['MEMCACHE_PASSWORD'] = 'GCnQ9DhfEJqNDlo1'
     environ['MEMCACHE_SERVERS'] = 'mc3.ec2.northscale.net'
     self.assertEqual(memcacheify(), {'default':
         {'BACKEND': 'django.core.cache.backends.locmem.LocMemCache'}
     })
     del environ['MEMCACHE_PASSWORD']
     del environ['MEMCACHE_SERVERS']
开发者ID:GetAmbassador,项目名称:django-heroku-memcacheify,代码行数:8,代码来源:tests.py


示例4: test_sets_proper_backend_when_memcache_addon_is_available

 def test_sets_proper_backend_when_memcache_addon_is_available(self):
     environ['MEMCACHE_PASSWORD'] = 'GCnQ9DhfEJqNDlo1'
     environ['MEMCACHE_SERVERS'] = 'mc3.ec2.northscale.net'
     environ['MEMCACHE_USERNAME'] = 'appxxxxx%40heroku.com'
     self.assertEqual(memcacheify()['default']['BACKEND'],
             'django_pylibmc.memcached.PyLibMCCache')
     del environ['MEMCACHE_PASSWORD']
     del environ['MEMCACHE_SERVERS']
     del environ['MEMCACHE_USERNAME']
开发者ID:GetAmbassador,项目名称:django-heroku-memcacheify,代码行数:9,代码来源:tests.py


示例5: get_cache_config

def get_cache_config():
    """Return a fully configured Django ``CACHES`` setting.

    Scans environment variables for available memcache addon.
    Additionally includes Django's LocMemCache backend under ``"locmem"``
    cache name.
    """
    caches = memcacheify()
    caches["locmem"] = {
        "BACKEND": "django.core.cache.backends.locmem.LocMemCache"
    }
    return caches
开发者ID:Rovel,项目名称:django-herokuify,代码行数:12,代码来源:cache.py


示例6: test_sets_proper_backend_when_memcachier_addon_is_available

    def test_sets_proper_backend_when_memcachier_addon_is_available(self):
        environ["MEMCACHIER_PASSWORD"] = "xxx"
        environ["MEMCACHIER_SERVERS"] = "mc1.ec2.memcachier.com"
        environ["MEMCACHIER_USERNAME"] = "xxx"

        caches = memcacheify()
        self.assertEqual(caches["default"]["BACKEND"], "django_pylibmc.memcached.PyLibMCCache")
        self.assertEqual(environ["MEMCACHE_SERVERS"], environ["MEMCACHIER_SERVERS"])
        self.assertEqual(environ["MEMCACHE_USERNAME"], environ["MEMCACHIER_USERNAME"])
        self.assertEqual(environ["MEMCACHE_PASSWORD"], environ["MEMCACHIER_PASSWORD"])

        del environ["MEMCACHIER_PASSWORD"]
        del environ["MEMCACHIER_SERVERS"]
        del environ["MEMCACHIER_USERNAME"]
        del environ["MEMCACHE_PASSWORD"]
        del environ["MEMCACHE_SERVERS"]
        del environ["MEMCACHE_USERNAME"]
开发者ID:Mondego,项目名称:pyreco,代码行数:17,代码来源:allPythonContent.py


示例7: test_sets_proper_backend_when_memcachedcloud_addon_is_available

    def test_sets_proper_backend_when_memcachedcloud_addon_is_available(self):
        environ['MEMCACHEDCLOUD_PASSWORD'] = 'xyz'
        environ['MEMCACHEDCLOUD_SERVERS'] = 'zzzz'
        environ['MEMCACHEDCLOUD_USERNAME'] = 'xyzzy'

        caches = memcacheify()
        self.assertEqual(caches['default']['BACKEND'], 'django_pylibmc.memcached.PyLibMCCache')
        self.assertEqual(environ['MEMCACHE_SERVERS'], environ['MEMCACHEDCLOUD_SERVERS'])
        self.assertEqual(environ['MEMCACHE_USERNAME'], environ['MEMCACHEDCLOUD_USERNAME'])
        self.assertEqual(environ['MEMCACHE_PASSWORD'], environ['MEMCACHEDCLOUD_PASSWORD'])

        del environ['MEMCACHEDCLOUD_PASSWORD']
        del environ['MEMCACHEDCLOUD_SERVERS']
        del environ['MEMCACHEDCLOUD_USERNAME']
        del environ['MEMCACHE_PASSWORD']
        del environ['MEMCACHE_SERVERS']
        del environ['MEMCACHE_USERNAME']
开发者ID:citadelgrad,项目名称:django-heroku-memcacheify,代码行数:17,代码来源:tests.py


示例8: CACHES

    def CACHES(self):
        """
        Return a fully configured Django ``CACHES`` setting.

        Scans environment variables for available memcache add-on.
        Additionally includes Django's LocMemCache backend under ``"locmem"``
        cache name.
        """
        from memcacheify import memcacheify

        caches = memcacheify()
        caches.update({
            "locmem": {
                "BACKEND": "django.core.cache.backends.locmem.LocMemCache"
            },
            "dummy": {
                "BACKEND": "django.core.cache.backends.dummy.DummyCache",
            }
        })
        return caches
开发者ID:nigma,项目名称:django-common-configs,代码行数:20,代码来源:heroku.py


示例9: postgresify

EMAIL_USE_TLS = True

# See: https://docs.djangoproject.com/en/dev/ref/settings/#server-email
SERVER_EMAIL = EMAIL_HOST_USER


## Database configuration
# See: https://docs.djangoproject.com/en/dev/ref/settings/#databases
DATABASES = postgresify()


## Cache configuration
# See: https://docs.djangoproject.com/en/dev/ref/settings/#caches
if CACHES is None:
    CACHES = dict()
CACHES.update(memcacheify())


## Secret key configuration
# See: https://docs.djangoproject.com/en/dev/ref/settings/#secret-key
# Use the value set in the Heroku configuration.
SECRET_KEY = os.environ.get('SECRET_KEY', SECRET_KEY)


## Gunicorn configuration
# See: http://gunicorn.org/run.html
# See: https://docs.djangoproject.com/en/dev/howto/deployment/wsgi/gunicorn/
INSTALLED_APPS += (
    'gunicorn',
)
开发者ID:PrecisionMojo,项目名称:vsub-api,代码行数:30,代码来源:production.py


示例10: memcacheify

DATABASES = {
    'default': env.db(),
}


#####
# Cache Settings

# Attempt to get the memcache info from Heroku.
try:
    # `django-heroku-memcachify` requires memcache to work. Since we only
    # need it on heroku and don't want to require libmemcached on dev
    # machines, we'll only use it if it's installed
    from memcacheify import memcacheify
    default_cache = memcacheify()['default']

    # memcacheify will use the LocMemCache if there is no heroku cache. So if
    # we see the 'LocMemCache' we know that memcachify is not running on a
    # heroku dyno that is setup for memcached
    # pylint: disable=line-too-long
    if default_cache['BACKEND'] == 'django.core.cache.backends.locmem.LocMemCache':
        default_cache = env.cache()

except ImportError:
    # If `django-heroku-memcachify` is not installed, just use the cache
    # defined in the environment
    default_cache = env.cache()


CACHES = {
开发者ID:lpatmo,项目名称:actionify_the_news,代码行数:30,代码来源:base_settings.py


示例11: test_uses_local_memory_backend_if_no_memcachier_addon_is_available

 def test_uses_local_memory_backend_if_no_memcachier_addon_is_available(self):
     environ["MEMCACHIER_PASSWORD"] = "xxx"
     environ["MEMCACHIER_SERVERS"] = "mc1.ec2.memcachier.com"
     self.assertEqual(memcacheify(), {"default": {"BACKEND": "django.core.cache.backends.locmem.LocMemCache"}})
     del environ["MEMCACHIER_PASSWORD"]
     del environ["MEMCACHIER_SERVERS"]
开发者ID:Mondego,项目名称:pyreco,代码行数:6,代码来源:allPythonContent.py


示例12: test_uses_local_memory_backend_if_no_memcache_addon_is_available

 def test_uses_local_memory_backend_if_no_memcache_addon_is_available(self):
     self.assertEqual(memcacheify(), {"default": {"BACKEND": "django.core.cache.backends.locmem.LocMemCache"}})
开发者ID:Mondego,项目名称:pyreco,代码行数:2,代码来源:allPythonContent.py


示例13: test_uses_local_memory_backend_if_no_memcache_addon_is_available

 def test_uses_local_memory_backend_if_no_memcache_addon_is_available(self):
     self.assertEqual(memcacheify(), {'default':
         {'BACKEND': 'django.core.cache.backends.locmem.LocMemCache'}
     })
开发者ID:GetAmbassador,项目名称:django-heroku-memcacheify,代码行数:4,代码来源:tests.py


示例14: memcacheify

KEY_PREFIX = TREEHERDER_MEMCACHED_KEY_PREFIX

# celery broker setup
BROKER_URL = 'amqp://{0}:{1}@{2}:{3}/{4}'.format(
    RABBITMQ_USER,
    RABBITMQ_PASSWORD,
    RABBITMQ_HOST,
    RABBITMQ_PORT,
    RABBITMQ_VHOST
)

# This code handles the memcachier service on heroku.
if "IS_HEROKU" in os.environ:
    from memcacheify import memcacheify
    CACHES['default'].update(
        memcacheify().get('default')
    )

if "CLOUDAMQP_URL" in os.environ:
    BROKER_URL = os.environ["CLOUDAMQP_URL"]
    BROKER_POOL_LIMIT = 1

CELERY_IGNORE_RESULT = True

API_HOSTNAME = SITE_URL

BROWSERID_AUDIENCES = [SITE_URL]

SWAGGER_SETTINGS = {"enabled_methods": ['get', ]}

REST_FRAMEWORK_EXTENSIONS = {
开发者ID:EdgarChen,项目名称:treeherder,代码行数:31,代码来源:base.py


示例15: tests_uses_local_memory_backend_if_one_of_the_memcache_env_vars_is_missing

 def tests_uses_local_memory_backend_if_one_of_the_memcache_env_vars_is_missing(self):
     environ["MEMCACHE_PASSWORD"] = "GCnQ9DhfEJqNDlo1"
     environ["MEMCACHE_SERVERS"] = "mc3.ec2.northscale.net"
     self.assertEqual(memcacheify(), {"default": {"BACKEND": "django.core.cache.backends.locmem.LocMemCache"}})
     del environ["MEMCACHE_PASSWORD"]
     del environ["MEMCACHE_SERVERS"]
开发者ID:Mondego,项目名称:pyreco,代码行数:6,代码来源:allPythonContent.py


示例16: memcacheify

AWS_AUTO_CREATE_BUCKET = True
AWS_HEADERS = {
    "Cache-Control": "public, max-age=86400",
}
AWS_S3_CUSTOM_DOMAIN = '%s.s3.amazonaws.com' % AWS_STORAGE_BUCKET_NAME
STATIC_URL = "https://%s/" % AWS_S3_CUSTOM_DOMAIN
COMPRESS_URL = STATIC_URL
MEDIA_URL = "https://%s/media/" % AWS_S3_CUSTOM_DOMAIN

AWS_S3_FILE_OVERWRITE = True
AWS_QUERYSTRING_AUTH = False
AWS_S3_SECURE_URLS = True
AWS_REDUCED_REDUNDANCY = True
AWS_IS_GZIPPED = False

CACHES = memcacheify()

# Compress static files offline
COMPRESS_CSS_FILTERS = [
    'compressor.filters.css_default.CssAbsoluteFilter',
    'compressor.filters.cssmin.CSSMinFilter',
]
COMPRESS_ROOT = STATIC_ROOT
COMPRESS_STORAGE = STATICFILES_STORAGE
COMPRESS_OFFLINE = True
COMPRESS_ENABLED = True

LOGGING = {
    "version": 1,
    "disable_existing_loggers": False,
    "handlers": {
开发者ID:jordij,项目名称:bctt.nz,代码行数:31,代码来源:production.py


示例17:

        "OPTIONS": {"MAX_ENTRIES": 1000},
    },
}

KEY_PREFIX = TREEHERDER_MEMCACHED_KEY_PREFIX

# celery broker setup
BROKER_URL = "amqp://{0}:{1}@{2}:{3}/{4}".format(
    RABBITMQ_USER, RABBITMQ_PASSWORD, RABBITMQ_HOST, RABBITMQ_PORT, RABBITMQ_VHOST
)

# This code handles the memcachier service on heroku.
if "IS_HEROKU" in os.environ:
    from memcacheify import memcacheify

    CACHES["default"].update(memcacheify().get("default"))

if "CLOUDAMQP_URL" in os.environ:
    BROKER_URL = os.environ["CLOUDAMQP_URL"]
    BROKER_POOL_LIMIT = 1


CELERY_IGNORE_RESULT = True

API_HOSTNAME = SITE_URL

BROWSERID_AUDIENCES = [SITE_URL]

SWAGGER_SETTINGS = {"enabled_methods": ["get"]}

REST_FRAMEWORK_EXTENSIONS = {"DEFAULT_CACHE_RESPONSE_TIMEOUT": 60 * 15}
开发者ID:serious6,项目名称:treeherder,代码行数:31,代码来源:base.py



注:本文中的memcacheify.memcacheify函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python memobject.MemObject类代码示例发布时间:2022-05-27
下一篇:
Python data_helper.VBucketAwareMemcached类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap