当前位置: 首页 > 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://www.yutouwan.com/news/378592/

相关文章:

  • seo专业培训网络班重庆好的seo平台
  • 网站建设回龙观wap手机建站平台
  • 山西省消防总队建设工程备案网站公司网站开发费用
  • 佛山建站专公司网站域名及空间
  • 西安网站开发公司电话杭州网站开发建设
  • 网站建设与维修网络营销跟网站推广有啥区别
  • 廊坊网站建设优化网站建设前端学什么语言
  • 如何做网站横幅如何重装电脑的wordpress
  • 郑州哪家建设网站带音乐网站模板
  • wordpress图片站主题织梦网站文章发布模板下载
  • 岳阳网站建设 熊掌号网页设计摘要内容
  • 网站 微信 appcnzz统计代码如何添加到网站上去
  • 给网站做seo的价格青岛做网站哪里好
  • 塘沽建设网站注册证查询网站
  • 网站后台管理员做链接太和县建设银行网站
  • 网站将要准备建设的内容娄底做网站
  • 唐山高端网站建设上海注销公司需要什么资料和流程
  • 免费网站推广ymdir导航网站怎么做
  • 国外开源 企业网站学做家常菜的网站有哪些
  • 怎么更改网站备案信息品牌官网方案
  • 长沙哪家网络公司做网站好域名注册服务器
  • 一个好的营销型网站模板平台里的钱提现不了怎么追回
  • 销售型网站怎么做的网页制作与设计类课程
  • 网站运营策划ppt个人备案域名可以做企业网站吗
  • 衡阳做网站工程公司资质怎么申请
  • 网站建设的收入来源wordpress 优化数据库
  • 上海房产交易网站鞍山最新通知今天
  • 国内好的seo网站4399影视在线观看免费高清
  • 微网站 网页广东省住建局官网
  • 公司网站怎么弄免费主机空间