Skip to content

Commit

Permalink
#492 Added 1 day cache to admin stats
Browse files Browse the repository at this point in the history
  • Loading branch information
cdausmus committed Jan 30, 2022
1 parent afc8782 commit 7650874
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
3 changes: 3 additions & 0 deletions grails-app/services/au/org/ala/volunteer/StatsService.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package au.org.ala.volunteer

import com.google.common.base.Stopwatch
import grails.transaction.Transactional
import grails.plugin.cache.Cacheable
import groovy.sql.Sql

import javax.sql.DataSource
Expand Down Expand Up @@ -532,6 +533,7 @@ class StatsService {
return results
}

@Cacheable(value = 'StatsHourlyContribution', key = "(#institution?.id?.toString()?:'-1') + (#startDate?.getTime()?:'-1') + (#endDate?.getTime()?:'-1')")
def getHourlyContributions(Date startDate, Date endDate, Institution institution) {
def taskView = ""
def taskJoin = ""
Expand Down Expand Up @@ -601,6 +603,7 @@ class StatsService {
return results
}

@Cacheable(value = 'StatsTranscriptionTime', key = "(#institution?.id?.toString()?:'-1') + (#startDate?.getTime()?:'-1') + (#endDate?.getTime()?:'-1')")
def getTranscriptionTimeByProjectType(Date startDate, Date endDate, Institution institution) {
def institutionClause = ""
def params = [:]
Expand Down
26 changes: 26 additions & 0 deletions src/main/resources/digivol-ehcache.xml
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,32 @@
logging="true"
>
</cache>
<cache
name="StatsTranscriptionTime"
eternal="false"
timeToLiveSeconds="86400"
maxElementsInMemory="1000"
maxElementsOnDisk="2000"
memoryStoreEvictionPolicy="LRU"
overflowToDisk="true"
diskPersistent="false"
diskExpiryThreadIntervalSeconds="120"
logging="true"
>
</cache>
<cache
name="StatsHourlyContribution"
eternal="false"
timeToLiveSeconds="86400"
maxElementsInMemory="1000"
maxElementsOnDisk="2000"
memoryStoreEvictionPolicy="LRU"
overflowToDisk="true"
diskPersistent="false"
diskExpiryThreadIntervalSeconds="120"
logging="true"
>
</cache>
<cache
name="getImageMetaData"
eternal="false"
Expand Down

0 comments on commit 7650874

Please sign in to comment.