我想创建一个与auth0 API通信的控制器,但我是初级开发人员,我有一些问题。首先,我想替换从DB取代的缓存而不是refreshApiToken方法:
#include <stdio.h>
#include <signal.h>
#include <stdlib.h>
char interrupted=0;
void exit_handler(int sig){
interrupted=1;
}
int main(char** argc, int argv)
{
FILE *fd;
signal(SIGINT, exit_handler);
signal(SIGTERM, exit_handler);
while(1){
fd=fopen("filepath.file","w");
char *tst_str="Test String";
if(fwrite(tst_str,1,11,fd)!=11)
printf("Writing Error occured\n");
if (fileno(fd)>=0){
printf("FD Closed. (1)\n");
fclose(fd);
}
if (fileno(fd)>=0){
printf("FD Closed. (2)\n");
fclose(fd);
}
if(interrupted)
exit(0);
}
printf("Done.");
}
此方法应将令牌存储在DB中的Cache对象中并返回void:
private String getAuthToken() {
Cache cache = new Cache();
cache.setApiToken(this.refreshApiToken());
return cache.getApiToken();
}
你能给我一些建议吗?