mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-23 06:51:27 +00:00
Merge pull request #1212 from pixelfed/frontend-ui-refactor
Frontend ui refactor
This commit is contained in:
commit
2288034b8a
2 changed files with 9 additions and 2 deletions
|
@ -75,7 +75,7 @@ class ApiController extends BaseApiController
|
||||||
->whereNull('status')
|
->whereNull('status')
|
||||||
->whereNull('domain')
|
->whereNull('domain')
|
||||||
->inRandomOrder()
|
->inRandomOrder()
|
||||||
->take(4)
|
->take(3)
|
||||||
->get()
|
->get()
|
||||||
->map(function($item, $key) {
|
->map(function($item, $key) {
|
||||||
return [
|
return [
|
||||||
|
|
|
@ -34,9 +34,14 @@ class SuggestionService {
|
||||||
return self::del($val);
|
return self::del($val);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function count()
|
||||||
|
{
|
||||||
|
return Redis::zcount(self::CACHE_KEY, '-inf', '+inf');
|
||||||
|
}
|
||||||
|
|
||||||
public static function warmCache($force = false)
|
public static function warmCache($force = false)
|
||||||
{
|
{
|
||||||
if(Redis::zcount(self::CACHE_KEY, '-inf', '+inf') == 0 || $force == true) {
|
if(self::count() == 0 || $force == true) {
|
||||||
$ids = Profile::whereNull('domain')
|
$ids = Profile::whereNull('domain')
|
||||||
->whereIsSuggestable(true)
|
->whereIsSuggestable(true)
|
||||||
->whereIsPrivate(false)
|
->whereIsPrivate(false)
|
||||||
|
@ -44,6 +49,8 @@ class SuggestionService {
|
||||||
foreach($ids as $id) {
|
foreach($ids as $id) {
|
||||||
self::set($id);
|
self::set($id);
|
||||||
}
|
}
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue