Skip to content
Permalink
Browse files

Remove disk cache support

  • Loading branch information...
dvdbng committed Nov 11, 2015
1 parent c4f8c91 commit 15091480ecbd7bbc27f8f259ac169286e5c572f6
Showing with 2 additions and 52 deletions.
  1. +0 −14 splash/cache.py
  2. +0 −5 splash/defaults.py
  3. +2 −3 splash/network_manager.py
  4. +0 −29 splash/server.py
  5. +0 −1 splash/tests/utils.py

This file was deleted.

@@ -72,11 +72,6 @@
# pool options
SLOTS = 50

# disk cache options - don't enable it unless you know what you're doing
CACHE_ENABLED = False
CACHE_SIZE = 50 # MB
CACHE_PATH = '.splash-cache'

# security options
ALLOWED_SCHEMES = ['http', 'https', 'data', 'ftp', 'sftp', 'ws', 'wss']
JS_CROSS_DOMAIN_ENABLED = False
@@ -29,8 +29,7 @@


class NetworkManagerFactory(object):
def __init__(self, filters_path=None, verbosity=None, allowed_schemes=None, cache=None):
self.cache = cache
def __init__(self, filters_path=None, verbosity=None, allowed_schemes=None):
self.verbosity = defaults.VERBOSITY if verbosity is None else verbosity

if filters_path is not None:
@@ -49,7 +48,7 @@ def __call__(self):
allowed_schemes=self.allowed_schemes,
verbosity=self.verbosity,
)
manager.setCache(self.cache)
manager.setCache(None)
return manager


@@ -46,13 +46,6 @@ def parse_opts():
default=defaults.JS_CROSS_DOMAIN_ENABLED,
help="enable support for cross domain access when executing custom javascript "
"(WARNING: it could break rendering for some of the websites)" + _bool_default[defaults.JS_CROSS_DOMAIN_ENABLED])
op.add_option("--no-cache", action="store_false", dest="cache_enabled",
help="disable local cache" + _bool_default[not defaults.CACHE_ENABLED])
op.add_option("--cache", action="store_true", dest="cache_enabled",
help="enable local cache (WARNING: don't enable it unless you know what are you doing)" + _bool_default[defaults.CACHE_ENABLED])
op.add_option("-c", "--cache-path", help="local cache folder")
op.add_option("--cache-size", type=int, default=defaults.CACHE_SIZE,
help="maximum cache size in MB (default: %default)")
op.add_option("--manhole", action="store_true",
help="enable manhole server")
op.add_option("--disable-proxy", action="store_true", default=False,
@@ -251,7 +244,6 @@ def force_shutdown():


def default_splash_server(portnum, max_timeout, slots=None,
cache_enabled=None, cache_path=None, cache_size=None,
proxy_profiles_path=None, js_profiles_path=None,
js_disable_cross_domain_access=False,
disable_proxy=False, proxy_portnum=None,
@@ -268,7 +260,6 @@ def default_splash_server(portnum, max_timeout, slots=None,
filters_path=filters_path,
verbosity=verbosity,
allowed_schemes=allowed_schemes,
cache=_default_cache(cache_enabled, cache_path, cache_size),
)
splash_proxy_factory_cls = _default_proxy_factory(proxy_profiles_path)
js_profiles_path = _check_js_profiles_path(js_profiles_path)
@@ -291,23 +282,6 @@ def default_splash_server(portnum, max_timeout, slots=None,
)


def _default_cache(cache_enabled, cache_path, cache_size):
from twisted.python import log
from splash import cache

cache_enabled = defaults.CACHE_ENABLED if cache_enabled is None else cache_enabled
cache_path = defaults.CACHE_PATH if cache_path is None else cache_path
cache_size = defaults.CACHE_SIZE if cache_size is None else cache_size

if cache_enabled:
log.msg("cache_enabled=%s, cache_path=%r, cache_size=%sMB" % (cache_enabled, cache_path, cache_size))
log.msg("[WARNING] You have enabled cache support. QT cache is known "
"to cause segfaults and other issues for splash; "
"enable it on your own risk. We recommend using a separate "
"caching forward proxy like squid.")
return cache.construct(cache_path, cache_size)


def _default_proxy_factory(proxy_profiles_path):
from twisted.python import log
from splash import proxy
@@ -370,9 +344,6 @@ def main():
default_splash_server(
portnum=opts.port,
slots=opts.slots,
cache_enabled=opts.cache_enabled,
cache_path=opts.cache_path,
cache_size=opts.cache_size,
proxy_profiles_path=opts.proxy_profiles_path,
js_profiles_path=opts.js_profiles_path,
js_disable_cross_domain_access=not opts.js_cross_domain_enabled,
@@ -59,7 +59,6 @@ def __init__(self, logfile=None, proxy_profiles_path=None,

def __enter__(self):
args = [sys.executable, '-u', '-m', 'splash.server']
args += ['--cache-path', self.tempdir]
args += ['--port', str(self.portnum)]
args += ['--verbosity', str(self.verbosity)]
if self.logfile:

3 comments on commit 1509148

@genius001

This comment has been minimized.

Copy link

replied Dec 31, 2015

Hello, Youwotma
I'm newbie on splash.
I think disk cache is a good point on sometimes,
but why remove this support?

thank you for reply:)

@dvdbng

This comment has been minimized.

Copy link
Contributor Author

replied Jan 1, 2016

Hi @genius001!

Disk cache didn't was crashy and unstable so we decided to remove it. Users can use a caching proxy like squid to have the same effect, but more stable.

@genius001

This comment has been minimized.

Copy link

replied Jan 2, 2016

Hi @Youwotma

Very thank you!

Please sign in to comment.
You can’t perform that action at this time.