php - How to represent hit count with Domain Driven Design -
Suppose context is a job portal website.
I have a requirement that says something like this:
When a job site maker sees the vacancy, the number of vacancy increases. < / Blockquote>
How do I show it in the web?
As far as I can think, it depends on which controller has requested a vacancy, maybe something like this:
Class Emptiness Controller {Public Celebration View ($ vacancyId) {$ vacancy = $ this- & gt; Repo-> ($ VacancyId); $ Vacancy-> IncrementView (); $ This- & gt; Repo-> Continues ($ spacing); Return $ spacing; }}
Is there a way to represent such a rule in the domain level?
Syncing an updated view number is not a good idea, especially when using the RDBMS database < / P>
update vacancy_view set count = count + 1 where vacancy_id = $ id
Many users may be blocked if a lot of users are in one place Duration of time only visible space
I suggest using "insert" instead. The inclusion may be synchronous or asynchronous, depending on the benchmark. But it can be hidden behind the implementation details app. Events Abstraction In this case of use, the last compatibility is generally tolerated, when the count of visual count can be done.
Class Empty Controls {Public Work View Vocational ($ vacancyId) {$ vacancy = $ this- & gt; Repo-> ($ VacancyId); $ This- & gt; Application avent-> Increase ($ vacancyId) Spacing $ spacing; }}
It has been said that some nosql databases (like Cassandra) are well-fit in well-viewed scenario, but I have not experienced it yet.
Comments
Post a Comment