Skip to content

Commit

Permalink
harmonizing cached files
Browse files Browse the repository at this point in the history
  • Loading branch information
palladius committed Sep 24, 2024
1 parent 7665dc0 commit f776fcb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions bin/serp-google-finance-cached.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@

# Note: SPy doesnt work, probably as the default Nasdaq suffix wont work for it.
$sample_stocks = %w{ AAPL GOOG GOOGL NVDA NFLX TSLA SPY} # NYSEARCA:SPY
$prog_version = '1.1'
$prog_version = '1.1b'
$default_stock = 'GOOGL'
$stock_to_check = ARGV[0] || $default_stock
puts("🔧 Checking Stock: #{$stock_to_check}")

def cached_google_search(params, version=$prog_version)
cache_key = Digest::MD5.hexdigest(params.to_s + $prog_version) # so it changes cache if you bump up version
cache_file = ".cache/google_search_#{cache_key}.json"
cache_file = ".cache/serp.finance.#{cache_key}.json"

if File.exist?(cache_file)
puts Rainbow("[debug] Cache hit: #{cache_file}").green
Expand Down

0 comments on commit f776fcb

Please sign in to comment.