当前位置: 首页 > news >正文

免费网络爬虫网站纯 flash 网站

免费网络爬虫网站,纯 flash 网站,运营什么网站好,做淘客网站需要营业执照吗数据越积越多#xff0c;过于冗余#xff1b;数据库定期删除指定时间前的数据#xff1b;文件生成的删除指定时间前端文件 SFTP文件定期删除 java sftp 定时清理指定文件中固定时间 依赖 !-- ftp文件上传/下载Jar包 -- dependencygroupIdcom.jc…数据越积越多过于冗余数据库定期删除指定时间前的数据文件生成的删除指定时间前端文件 SFTP文件定期删除 java sftp 定时清理指定文件中固定时间 依赖 !-- ftp文件上传/下载Jar包 -- dependencygroupIdcom.jcraft/groupIdartifactIdjsch/artifactIdversion0.1.54/version /dependency代码 import com.jcraft.jsch.*;import java.util.Vector;/*** java sftp 定时清理指定文件中固定时间*/ public class SftpCleanup {public static void main(String[] args) throws JSchException {String host 127.0.0.1; // SFTP主机地址int port 22; // SFTP端口号String username xxx; // SFTP登录用户名String password xxxx; // SFTP登录密码Session session null;ChannelSftp channelSftp null;try {JSch jsch new JSch();// 创建Session对象session jsch.getSession(username, host, port);session.setPassword(password);session.setConfig(StrictHostKeyChecking, no);session.connect();// 打开ChannelSftp通道channelSftp (ChannelSftp) session.openChannel(sftp);channelSftp.connect();// 设置删除目标文件的路径及过期时间单位为分钟// 默认为当前日期之前的24小时内的文件将被删除//long expireTimeInMinutes 60 * 24;long currentTimeMillis System.currentTimeMillis();//long threeMonthsAgoInMillis currentTimeMillis - 2 * 7 * 60 * 60 * 1000L; // 当前时间减去N个天的毫秒数long threeMonthsAgoInMillis currentTimeMillis - 90 * 24 * 60 * 60 * 1000L; // 当前时间减去3个月(3*30)的毫秒数String targetPath /data/file/hi/; // 目标文件路径VectorChannelSftp.LsEntry fileList channelSftp.ls(targetPath); // 要清理的目标文件所在路径for (ChannelSftp.LsEntry entry : fileList) {if (!entry.getAttrs().isDir()) {long fileCreationTime entry.getAttrs().getMTime() * 1000L;printTimeDifference(true, fileCreationTime, threeMonthsAgoInMillis);if (fileCreationTime threeMonthsAgoInMillis) {channelSftp.rm(targetPath entry.getFilename()); // 删除符合条件的文件System.out.println(成功删除文件 targetPath entry.getFilename());} else {System.out.println(未到达过期时间不处理文件 targetPath entry.getFilename());}}}} catch (JSchException | SftpException e) {e.printStackTrace();} finally {// 关闭ChannelSftp通道和会话if (channelSftp ! null channelSftp.isConnected()) {channelSftp.disconnect();}if (session ! null session.isConnected()) {session.disconnect();}}}/*** 打印计算时间差** param fileCreationTime sftpFileTime* param presetsTimeMillis threeMonthsAgoInMillis*/private static void printTimeDifference(boolean debugger, long fileCreationTime, long presetsTimeMillis) {// 计算两者之间的差值单位微秒long diffMicroseconds (fileCreationTime - presetsTimeMillis);// 将差值转化为小时、分钟和秒int days (int) (diffMicroseconds / (24 * 60 * 60 * 1000));int hours (int) (diffMicroseconds / (60 * 60 * 1000));int minutes (int) ((diffMicroseconds % (60 * 60 * 1000)) / (60 * 1000));int seconds (int) ((diffMicroseconds % (60 * 1000)) / 1000);// 输出结果//System.out.println(差值为 diffMicroseconds 微秒);if (debugger) {System.out.println(差值为 days 天 hours 小时 minutes 分钟 seconds 秒);}} } mysql保存N个月的数据 mysql中保存3个月的数据当超过3个月之后定时清除3个月之前的数据 Mysql -- 至少保留一个月数据量 delete from table_name SELECT DATE_SUB(NOW(), INTERVAL 1 MONTH); select count(*) from table_name where create_time DATE_SUB(NOW(), INTERVAL 1 MONTH);Api public void deleteCustomerTouch(String monthNum) {if (StringUtils.isBlank(monthNum)) {monthNum YsConst.Month.THREE;}//值不为空且值为数值且值要大于等于1if (NumberUtil.isNumber(monthNum) NumberUtil.parseInt(monthNum) 1) {apiService.deleteByTime(monthNum);} else {logger.error(【apiService】其他的参数错误 monthNum{}, monthNum);}}Mapper !-- 小于等于 --delete iddeleteByTimedelete from table_name where create_time lt; DATE_SUB(NOW(), INTERVAL #{monthNum} MONTH)/delete
http://wiki.neutronadmin.com/news/378592/

相关文章:

  • 网站建设方式与信息化拼多多海外跨境电商入驻流程
  • 沈阳企业网站建设惠州免费建站模板
  • 外贸婚纱礼服网站北京免费分类信息发布网
  • 网站安全建设模板100个最佳市场营销案例
  • 专业微网站电话ip地址反查域名
  • 湘潭网站建设 磐石网络在哪模板建站多少钱
  • 联邦快递网站建设的目标小程序商城装修
  • 厦门市建设工程造价网站首页ios个人开发者账号
  • 网站推广公司需要多少钱东莞阳光网站官网
  • 部门网站建设个人总结合肥市网站建设公司
  • 网站建设公司南昌常州网站制作优化
  • 图片站wordpress模板建站工具论坛
  • 建设银行官方网站登录入口上海网站建设服务框架
  • 企业建设网站哪家好flash网站推荐
  • 网站设计制作需要多少钱青岛网页设计师
  • 发布网站后不可能存在的文件夹是网站备案号 英文
  • 做企业网站需要注意哪些网站内容管理系统源码
  • 网站开发个人工作室网络服务是干什么的
  • 东莞做企业网站免费单页网站在线制作
  • 做好的网站模板怎么修改做通路富集分析的网站
  • 免费网站推广大北京大型商场一览表
  • 有了网址怎么做网站西安抖音代运营公司
  • 网站建设项目验收付款软件开发和网站建设哪个好
  • 石岩附近做网站公司杭州it培训
  • 西安便宜做网站关于asp网站模板下载
  • 网站推广妙招寻找移动网站建设
  • 网上购物网站建设论文6微信如何引流推广精准加人
  • 苏州和城乡建设局网站首页网站制作多久
  • 自考免费自学网站软件开发工具包可以卸载吗
  • 创建网站需要什么平台一站式营销平台