diff --git a/README.md b/README.md index 3195a1e..e0d3917 100644 --- a/README.md +++ b/README.md @@ -28,12 +28,28 @@ Compatibility with core CKAN versions: ## Config settings - List of config options: # Caching strategy for chart data (required, default: redis). ckanext.charts.cache_strategy = disk + # Time to live for the Redis cache in seconds. Set 0 to disable cache (default: 3600) + ckanext.charts.redis_cache_ttl = 7200 + + # Time to live for the File cache in seconds. Set 0 to disable cache. + ckanext.charts.file_cache_ttl = 0 + +## Cache + +The extension implement a cache strategy to store the data fetched from the different sources. There are two cache strategies available: `redis` and `file`. The file cache works by storing the data in an `orc` file in the filesystem. The redis cache stores the data in a Redis database. The cache strategy can be changed at the CKAN configuration level through the admin interface or in a configuration file. + +## Implementing new fetchers + +Fetchers are responsible for fetching data from different sources (DataStore, URL, file system, hardcoded data). + +To register new fetchers, you need to create a new class that inherits from `DataFetcherStrategy` and implements the `fetch_data` and `make_cache_key` methods. +The `fetch_data` method should return a `pandas` `DataFrame` object with the data that should be displayed in the chart. +The `make_cache_key` method should return a unique string that will be used as a key to store the data in the cache. ## Developer installation diff --git a/ckanext/charts/config_schema.yaml b/ckanext/charts/config_schema.yaml index 121dddc..789904b 100644 --- a/ckanext/charts/config_schema.yaml +++ b/ckanext/charts/config_schema.yaml @@ -16,10 +16,10 @@ fields: - field_name: ckanext.charts.redis_cache_ttl label: Redis Cache TTL - help_text: Time to live for the cache in seconds. Set 0 to disable cache. + help_text: Time to live for the Redis cache in seconds. Set 0 to disable cache. input_type: number - field_name: ckanext.charts.file_cache_ttl label: File Cache TTL - help_text: Time to live for the cache in seconds. Set 0 to disable cache. + help_text: Time to live for the File cache in seconds. Set 0 to disable cache. input_type: number