Skip to content

FileCache store#4

Merged
nicogaldamez merged 11 commits intomainfrom
file-cache
Feb 12, 2025
Merged

FileCache store#4
nicogaldamez merged 11 commits intomainfrom
file-cache

Conversation

@nicogaldamez
Copy link
Member

Why

  • The gem needs a cache system that persists between sessions. It will primarily be used to store the Uber access token but could also store other data.

What

  • Add a FileCache store that saves key-value pairs in a YAML file.
  • FileCache store becomes the new default.

@nicogaldamez nicogaldamez added the enhancement New feature or request label Feb 11, 2025
@nicogaldamez nicogaldamez self-assigned this Feb 11, 2025
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no debería por defecto agregar el file cache al git ignore? (no digo al nuestro, sino al de cualquier app) y si no, al menos en el readme aclararlo.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sí, definitivamente. Al ser parametrizable no va a quedar otra que agregarlo en el Readme.

end

def teardown
File.delete(Ruber.configuration.file_cache_path) if File.exist?(Ruber.configuration.file_cache_path)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
File.delete(Ruber.configuration.file_cache_path) if File.exist?(Ruber.configuration.file_cache_path)
@cache.clear

Comment on lines +44 to +51
def test_clear
@cache.write("key1", "value1")
@cache.write("key2", "value2")

@cache.clear
assert_nil @cache.read("key1")
assert_nil @cache.read("key2")
end
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tengo una duda respecto a este test.

¿Qué pasa si volvés a escribir la caché después de hacer .clear? se vuelve a crear el archivo? tal vez se puede agregar al test ese caso para que quede claro.

Porque veo que el archivo se borra y no logro ver si se vuelve a crear.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sí, lo vuelve a crear. Ahí agrego un test más.

Copy link
Contributor

@bruno-costanzo bruno-costanzo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excelente!

@nicogaldamez nicogaldamez merged commit a7bc970 into main Feb 12, 2025
1 check passed
@nicogaldamez nicogaldamez deleted the file-cache branch February 12, 2025 17:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants