/adei/trunk

To get this branch, use:
bzr branch http://darksoft.org/webbzr/adei/trunk

« back to all changes in this revision

Viewing changes to classes/cache.php

  • Committer: Suren A. Chilingaryan
  • Date: 2020-02-25 02:48:42 UTC
  • Revision ID: csa@suren.me-20200225024842-bxcsd9drjoat10g9
Rename DATA to CACHEBuffer

Show diffs side-by-side

added added

removed removed

Lines of Context:
6
6
require("cache/datainterval.php");
7
7
require("cache/datapoint.php");
8
8
require("cache/cachedata.php");
 
9
require("cache/cachebuffer.php");
 
10
 
9
11
 
10
12
class CACHE extends CACHEDB {
11
13
 var $reader, $group;
47
49
 const VERBOSE = 1;
48
50
 const LAST_FULL_SECOND = 2;            // Cache last full second (i.e. beyond interval end)
49
51
  
50
 
 function __construct(GROUPRequest &$props, READER &$reader = NULL, $flags = 0) {
 
52
 function __construct(GROUPRequest $props, READER $reader = NULL, $flags = 0) {
51
53
    global $DEFAULT_MISSING_VALUE;
52
54
    
53
55
    parent::__construct($props);
55
57
    $opts = $this->req->GetOptions();
56
58
    $this->md5_postfix = $opts->Get('use_md5_postfix');
57
59
 
58
 
    if ($reader) $this->reader = &$reader;
 
60
    if ($reader) $this->reader = $reader;
59
61
    else {
60
62
        if ($this->req->srv['disconnected']) {
61
63
            if ($flags&CACHE::CREATE_UPDATER)
228
230
    }
229
231
 
230
232
 
231
 
    if ($subcall) $curdata = new DATA($this->items);
 
233
    if ($subcall) $curdata = new CACHEBuffer($this->items);
232
234
 
233
235
    if ($resolution) {
234
236
        $sections = ($end - $start) / $resolution;
283
285
                        $ivl->SetupWindow();
284
286
                        
285
287
                        if (!$this->HavePoints($ivl)) {
286
 
                            if (!$empty_data) $empty_data = new DATA($this->items);
 
288
                            if (!$empty_data) $empty_data = new CACHEBuffer($this->items);
287
289
                            $query = $this->CreateQuery($table, $substart, $empty_data);
288
290
                            $this->Insert($resolution, $query);
289
291
                            continue;
291
293
                    } else {
292
294
                        if (!$this->reader->HaveData($this->group, $substart, $substart + $resolution)) {
293
295
                            //echo "$substart (+$resolution)\n";
294
 
                            if (!$empty_data) $empty_data = new DATA($this->items);
 
296
                            if (!$empty_data) $empty_data = new CACHEBuffer($this->items);
295
297
 
296
298
                            $query = $this->CreateQuery($table, $substart, $empty_data);
297
299
                            $this->Insert($resolution, $query);