private function clean() { $now = time(); $db = Fastdb::instance('core', 'expirate'); $data = $db->data(); $data = !strstr($data, '{') ? array() : json_decode($data, true); if (count($data)) { foreach ($data as $key => $row) { if ($row['expire'] <= $now) { $dbRow = Fastdb::instance($row['ns'], $row['entity']); $dbRow->del($row['key']); } } } }
public static function tables() { $db = Fastdb::instance('core', 'count'); $dbt = container()->fbm('fma_table'); $rows = $db->keys(); $tables = array(); if (count($rows)) { foreach ($rows as $row) { list($ns, $index) = explode('_', $row, 2); $tDb = Fastdb::instance($ns, $index); if (!strstr($index, 'fma_')) { $t = $dbt->where('name = ' . $index)->first(true); if (is_null($t)) { $tableName = $index; $tables[$index]['count'] = $db->get($row); $data = $tDb->keys(); if (count($data)) { $first = Arrays::first($data); $first = json_decode($tDb->get($first), true); $fields = array_keys($first); $tables[$index]['fields'] = $fields; } else { $fields = array(); } self::structure($ns, $index, $fields); } } } } return $tables; }