ankane / disco

Recommendations for Ruby and Rails using collaborative filtering
MIT License
565 stars 11 forks source link

Storing recommendations in Redis #17

Closed Ashwin-op closed 2 years ago

Ashwin-op commented 2 years ago

Here it has been mentioned that we can store the recommender to a file, database, or any other storage system.

Can we also save the .bin file to Redis and perform recommendations?

ankane commented 2 years ago

Hey @Ashwin-op, you can store the recommender in any storage system, including Redis. Instead of File.binwrite("recommender.bin", bin), use redis.set("recommender", bin).

Ashwin-op commented 2 years ago

And since bin is of the type IO, we need to convert it into a string to store it right?

ankane commented 2 years ago

Hey @Ashwin-op, you can check the Ruby type with:

bin = Marshal.dump(recommender)
puts bin.class.name