Logging Unique Views in Laravel with Redis

02. Logging unique views for models

View full source code

If you need to log unique views in Laravel, you might reach for a database table to track IP addresses or another unique piece of data.

Let's take a look at speeding things up both in performance and complexity by using Redis and the HyperLogLog probabilistic data structure.

Once we're done, we'll set up a period command to sync views back to the database for easy ordering, and then create a trait to share functionality between other models.

Want to stay in the loop about new content?
Of course you do.

© 2024 Codecourse Ltd. All Rights Reserved. Born in the UK.