我有一个角度应用程序。它是使用 Angular Material 实现的。我使用了一个带有 22 列标签的表格。现在,当我最大化浏览器时,某些列未显示,移动浏览器中的事件所有列均未显示。我尝试过以下方法:
.html ::
<div *ngIf="!loadingAnimation && events.length > 0">
<h1>View All Events</h1>
<mat-form-field>
<input matInput (keyup)="applyFilter($event.target.value)" placeholder="Search">
</mat-form-field>
</div>
<div class="loading-shade" *ngIf="loadingAnimation" class="center">
<mat-spinner *ngIf="loadingAnimation"></mat-spinner>
</div>
<div fxLayout="row" *ngIf="!loadingAnimation && events.length > 0">
<mat-paginator [length]="totalEvents" [pageSize]="eventsPerPage" [pageSizeOptions]="pageSizeOptions" [showFirstLastButtons]="true" *ngIf="events.length > 0"
(page)="onChangedPage($event)"></mat-paginator>
<div class="table-container">
<table class="table table-hover" mat-table matSort [dataSource]="dataSource" (matSortChange)="changeSort($event)">
<ng-container matColumnDef="status" sticky >
<th mat-header-cell *matHeaderCellDef mat-sort-header> Status </th>
<td mat-cell *matCellDef="let event">
<!-- <a [routerLink]="['/events/details-events']" [queryParams]="{matchId: event.matchId}" > …Run Code Online (Sandbox Code Playgroud) 在我的应用程序中,我使用 spring webflux,并使用 webclient 从某些第 3 方 API 检索详细信息。现在,我想将第一次 webClient 响应存储在内存缓存中,以便第二次我可以直接从缓存中获取这些响应。我正在尝试在内存缓存机制和“咖啡”中使用Spring boot。但没有一个能按预期工作。 应用程序.yml:
spring:
cache:
cache-names: employee
caffiene:
spec: maximumSize=200, expireAfterAccess=5m
Run Code Online (Sandbox Code Playgroud)
EmployeeApplication.java:
@SpringBootApplication
@EnableCaching
public class EmployeeApplication{
public static void main(String[] args){
}
}
Run Code Online (Sandbox Code Playgroud)
EmployeeController.java:
它有一个休息端点employee/all,可以从第 3 方 Api 获取所有员工。
EmployeeService.java:
@Service
@Slf4j
public class EmployeeService{
@Autowired
private WebClient webClient;
@Autowired
private CacheManager cacheManager;
@Cacheable("employee")
public Mono<List<Employee>> getAllEmployee(){
log.info("inside employee service {}");
return webClient.get()
.uri("/employees/")
.retrieve()
.bodyToMono(Employee.class);
}
}
Run Code Online (Sandbox Code Playgroud)
虽然我已经配置了缓存名称,但当我第二次点击该网址时,它正在调用服务方法。需要使用什么缓存机制来缓存 Mono 响应?请建议。
我对 LinkedList 在 java 中的搜索复杂性感到困惑。我已经读过从 LinkedList 搜索元素的时间复杂度是 O(n)。比如说,
LinkedList<String> link=new LinkedList<String>();
link.add("A");
link.add("B");
link.add("C");
System.out.println(link.get(1));
Run Code Online (Sandbox Code Playgroud)
现在,从这里通过 get(index) 方法我们可以说搜索一个元素应该花费 O(1) 次。但我读过它需要 O(n)。有人可以帮我弄清楚概念吗?