blob: 6cf99248ecd43c8a27123aebb13141a16086b9fb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
<?php /* Copyright (c) 2024 Freya Murphy */
class Cache_model extends Model {
// the user cache
private $users;
function __construct($load) {
parent::__construct($load);
$this->users = array();
}
/**
* Gets a array of users
*/
public function get_users($objs) {
$ids = array();
foreach ($objs as $obj) {
$id = $obj['user_id'];
if (!array_key_exists($id, $this->users)) {
array_push($ids, intval($id));
}
}
if (!empty($ids)) {
$result = $this->main->db
->select('*')
->from('api.user')
->where_in('id', $ids)
->rows();
foreach ($result as $user) {
$id = $user['id'];
$this->users[$id] = $user;
}
}
return $this->users;
}
}
|