tchoulom / ViewCounterBundle

This bundle is used to count the number of views of a page.
MIT License
15 stars 11 forks source link

Other stat file method than disk #7

Closed tonyellow closed 3 years ago

tonyellow commented 4 years ago

I use this plugin inside a docker project. I was wondering if there are any other methods than disk cache to store the stats file? My filesystem is read only. Could i use a google droplet for example in combination with gaufrette?

Hope someone has a tip.

tchoulom commented 4 years ago

Hey,

For the moment there are not other methods than disk cache to store the stats file.

But, in order to solve this problem, you can for example share the stats file directory via docker-compose. You can also use google droplet and gaufrette.

if you want to use another File Manager, it must implements the "Tchoulom\ViewCounterBundle\Filesystem\FilesystemInterface"

The service "Tchoulom\ViewCounterBundle\Statistics\Statistics" uses the file Manager in order to save the stats data.

Hope this helps you.

tonyellow commented 4 years ago

I see, thanks for the info. When are the statistics written to file? After each viewcount? Dont see anything about cron. Hope you can clarify!

tchoulom commented 4 years ago

The statistics are written to file after viewcount. See the service "Tchoulom\ViewCounterBundle\Counter\AbstractViewCounter" , line 186

There is no cron.

tonyellow commented 4 years ago

Ok, so basically you dont want to use droplet for this as local storage would perform much better. Writing after every view count requires much i/o

tchoulom commented 4 years ago

The writing/read system on the disc could indeed be improved. But you can use droplet in your case as mentioned in my previous posts.

tchoulom commented 3 years ago

For information, the new version 5 offers new features that allow you to have your own statistics storage system.

To use your own statistics storage system, you must:

It is now also possible to avoid the creation of statistical data after each view count: https://github.com/tchoulom/ViewCounterBundle/blob/HEAD/Resources/doc/readme/tools-command-convert-to-stats.md#converts-viewcounter-entities-to-statistical-data

Hope this helps you.

tonyellow commented 3 years ago

The cron is just perfect. Will test today. Thanks!