承接 geocoder-php/cache-provider 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

geocoder-php/cache-provider

最新稳定版本:4.5.0

Composer 安装命令:

composer require geocoder-php/cache-provider

包简介

Cache the result of a provider

README 文档

README

Build Status Latest Stable Version Total Downloads Monthly Downloads Code Coverage Quality Score Software License

This is the a cache provider from the PHP Geocoder. This is a READ ONLY repository. See the main repo for information and documentation.

Install

composer require geocoder-php/cache-provider

Usage

The ProviderCache allows you to use any PSR-6 compatible cache driver. You can find compatible drivers on packagist.

By default, the result is cached forever. You can set a cache expiry by passing an integer representing the number of seconds as the third parameter.

$httpClient = new \Http\Discovery\Psr18Client();
$provider = new \Geocoder\Provider\GoogleMaps\GoogleMaps($httpClient);

$psr6Cache = new ArrayCachePool(); // Requires `cache/array-adapter` package

$cachedProvider = new \Geocoder\Provider\Cache\ProviderCache(
    $provider, // Provider to cache
    $psr6Cache, // PSR-6 compatible cache
    600 // Cache expiry, in seconds
);

$geocoder = new \Geocoder\StatefulGeocoder($cachedProvider, 'en');

// Will come from Google Maps API
$result1 = $geocoder->geocodeQuery(GeocodeQuery::create('Buckingham Palace, London'));
// Will come from the cache
$result2 = $geocoder->geocodeQuery(GeocodeQuery::create('Buckingham Palace, London'));

Contribute

Contributions are very welcome! Send a pull request to the main repository or report any issues you find on the issue tracker.

统计信息

  • 总下载量: 1.28M
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 7
  • 点击次数: 2
  • 依赖项目数: 9
  • 推荐数: 0

GitHub 信息

  • Stars: 7
  • Watchers: 2
  • Forks: 3
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-04