You are here

function geocoder_cache_set in Geocoder 7

Cache a geocoded result.

Parameters

mixed $geometry: A Geometry object, or FALSE (no result).

string $handler: The handler used to geocode this data.

mixed $data: The data used to fetch live geo data.

array $options: Handler-specific options that have effect on the result.

2 calls to geocoder_cache_set()
geocoder in ./geocoder.module
The Geocoder API call.
geocoder_widget_get_field_value in ./geocoder.widget.inc
Get a field's value based on geocoded data.

File

./geocoder.module, line 381

Code

function geocoder_cache_set($geometry, $handler, $data, $options) {

  // Don't cache no-results, to live geocode the same data again next time.
  if (!$geometry && !variable_get('geocoder_cache_empty_results', TRUE)) {
    return;
  }

  // Construct the cache id from result-relevant parameters.
  $data = compact('handler', 'data', 'options');
  $cid = _geocoder_cache_cid($data);

  // Cache result-relevant parameters together with the actual result, so cache records can be traced.
  $data['geometry'] = $geometry ? $geometry : FALSE;
  cache_set($cid, $data, 'cache_geocoder', variable_get('geocoder_cache_ttl', CACHE_PERMANENT));
}