From 692ab3671021c31899a8be87a52c560282536adb Mon Sep 17 00:00:00 2001 From: Khaled AbuShqear Date: Mon, 27 Feb 2023 00:31:41 +0300 Subject: [PATCH 1/2] Add instructions to use db as storage --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.md b/README.md index fedac3ab1..89075c1f0 100644 --- a/README.md +++ b/README.md @@ -511,6 +511,13 @@ If you store multiple sets of coordinates for each object, you can specify latit Venue.near("Paris", 50, latitude: :secondary_latitude, longitude: :secondary_longitude) ``` +Use ActiveRecord as cache +------------------------- + +This applies for ActiveRecord only, the default cache service is Redis, but we still can use Database instead, it is not +recommended in usual cases, but you can still follow +[this gist](https://gist.github.com/shqear93/4b07153b4ca7e4e4a41da492679f6c0e) to use databases as caching storage + ### Distance and Bearing When you run a geospatial query, the returned objects have two attributes added: From dbcc45408eab2fa6625cb44a86bf867ef31adf24 Mon Sep 17 00:00:00 2001 From: Khaled AbuShqear Date: Tue, 17 Sep 2024 18:55:13 +0300 Subject: [PATCH 2/2] apply feedback --- README.md | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 89075c1f0..1871c4502 100644 --- a/README.md +++ b/README.md @@ -376,6 +376,9 @@ Geocoder::Lookup.all_services.each{|service| Geocoder::Lookup.get(service).cache Do *not* include the prefix when passing a URL to be expired. Expiring `:all` will only expire keys with the configured prefix -- it will *not* expire every entry in your key/value store. +In addition to conventional cache stores like Redis, it's possible to keep your cache in the database using `ActiveRecord`. For example see [this gist](https://gist.github.com/shqear93/4b07153b4ca7e4e4a41da492679f6c0e). + + _Before you implement caching in your app please be sure that doing so does not violate the Terms of Service for your geocoding service._ @@ -511,13 +514,6 @@ If you store multiple sets of coordinates for each object, you can specify latit Venue.near("Paris", 50, latitude: :secondary_latitude, longitude: :secondary_longitude) ``` -Use ActiveRecord as cache -------------------------- - -This applies for ActiveRecord only, the default cache service is Redis, but we still can use Database instead, it is not -recommended in usual cases, but you can still follow -[this gist](https://gist.github.com/shqear93/4b07153b4ca7e4e4a41da492679f6c0e) to use databases as caching storage - ### Distance and Bearing When you run a geospatial query, the returned objects have two attributes added: