effigy.im icon indicating copy to clipboard operation
effigy.im copied to clipboard

Implement caching for Firebase Functions to improve efficiency

Open sweep-ai[bot] opened this issue 4 months ago • 2 comments

Purpose

Enhance the efficiency of Firebase Functions in the effigy.im project by implementing caching mechanisms. This will reduce unnecessary computations and API calls, particularly for frequently requested Ethereum addresses and ENS names.

Description

The changes in this pull request include:

  • Updating functions/index.js to implement caching:
    • Adding a caching layer for resolved Ethereum addresses and ENS names
    • Implementing cache expiration to ensure data freshness
    • Using Firebase Realtime Database or Firestore for persistent caching
  • Modifying functions/lib/blockiesSVG.js and functions/lib/blockiesPNG.js:
    • Adding cache checks before generating new identicons
    • Storing generated identicons in the cache
  • Updating functions/index.js to use cached data when available:
    • Checking cache before resolving addresses or generating identicons
    • Returning cached results if available and not expired

Summary

  • Implemented caching for resolved Ethereum addresses and ENS names in functions/index.js
  • Added caching for generated SVG and PNG identicons in functions/lib/blockiesSVG.js and functions/lib/blockiesPNG.js
  • Created unit tests in functions/test/caching.test.js and integration tests in functions/test/integration.test.js to verify the caching functionality
  • Updated functions/readme.md to explain the new caching mechanism

Fixes

#21. Continue the conversation here: https://app.sweep.dev/c/890b5c0f-43b0-4a72-abfb-9b72282864d4.

To have Sweep make further changes, please add a comment to this PR starting with "Sweep:".

:book: For more information on how to use Sweep, please read our documentation.

Tracking ID: adfc3713db

sweep-ai[bot] avatar Oct 11 '24 02:10 sweep-ai[bot]