Comments (10)
That's a pretty nice solution.
I will also store these time ranges in the seperated table.
from eloquent-viewable.
yeah this will be not possible to tell views for particular days, what if we make a separate table where we'll have one record for each page with a counter attribute, and using it in simple scenario to fetch just total views of a page but if someone asks for views of last month or last hour etc then use original table like we are using right now
Edit: Please use just unique views in other table
from eloquent-viewable.
give it a try and check if it works fine and faster, check my edit in above comment as well
from eloquent-viewable.
but for how much time we can store in cache if views are increasing in seconds?
from eloquent-viewable.
That is the problem we are facing.
from eloquent-viewable.
so i think cache cannot be best option for this, because views are always increasing in seconds so we should not update cache again and again in seconds
from eloquent-viewable.
Maybe adding an extra counter in the JSON object that's done by incrementing. This could be retrieved in a few miliseconds.
Then scheduling a command that recounts this number every hour or day.
Edit: Check my draft under draft ideas.
from eloquent-viewable.
yes it is a good idea to store the counting of views separately instead of storing a new record on every request that will take a huge space in database as well, and will also be slower while fetching
from eloquent-viewable.
But by doing that, we can't ask for the total page views that are maked in the past 30 minutes, 2 days or 2 montsh. I can also make this optional for the users who wants this. functionality.
This sounds to me as a nice solution
from eloquent-viewable.
Little update!
I have been working on v2 in the past few days and changed the workflow a little bit.
I think that I found a sweet solution. When the user try to retrieve the page visits of a specific time range, the returned value will be stored in the cache with a time limit.
It is actually a pretty simple solution xD. My first idea was to store these returned values in a different database table, until I released that I could use the cache for this.
I wil also work on a new documentation with more info about the workflow and requirements.
from eloquent-viewable.
Related Issues (20)
- give point to post author on unique post view HOT 1
- how can I get user post view count HOT 1
- how to get total number of views of all posts HOT 1
- Getting Column not found when using ->orderByViews() HOT 10
- Laravel 9 support HOT 6
- `touch` the parent timestamp if the view has been recorded HOT 3
- Error : Cannot record a view for a viewable type HOT 1
- How to add some fields to table views HOT 1
- cannot record new views instance HOT 2
- Is there a way to record a view on cyrildewit / eloquent-viewable with the user_id not just the viewable_id HOT 1
- local.ERROR: Undefined index: lifetime_in_minutes
- Class "Period" not found HOT 2
- How can I check if an auth user or a visitor has already viewed a post? HOT 4
- Laravel 10 Support HOT 2
- PHP 8.2 support HOT 2
- CyrildeWit\EloquentViewable\Views::forViewable(): Argument #1 ($viewable) must be of type HOT 1
- How to extend the package to also count other things HOT 2
- User show the post twice HOT 1
- [Question] Seperate records by type
- Sort OutType Error:
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from eloquent-viewable.