You are here

public function InstapageCmsPluginPageModel::savePageStatsCache in Instapage plugin 8.3

Same name and namespace in other branches
  1. 7.3 core/models/InstapageCmsPluginPageModel.php \InstapageCmsPluginPageModel::savePageStatsCache()

Saves the statistics of the page as a cache.

Parameters

array $data Lst of elements to save.:

File

core/models/InstapageCmsPluginPageModel.php, line 329

Class

InstapageCmsPluginPageModel
Class responsible for managing the landing pages.

Code

public function savePageStatsCache($data) {
  $db = InstapageCmsPluginDBModel::getInstance();
  foreach ($data as $key => $item) {
    $sql = 'UPDATE ' . $db->pagesTable . ' SET stats_cache = %s, stats_cache_expires = ' . time() . ' WHERE instapage_id = %s';
    $db
      ->query($sql, json_encode($item), $key);
  }
}